#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    17
    Rep Power
    0

    WxPython ("Python files wont work")


    I just started using wxPython today. And each python file i write wont work when i click on them. To make sure i didn't write the code wrong, i copied a pasted some code from a tutorial and it still wouldn't work.
    What i'm doing is i'm writing some code saving it as a .py file in the C:\Python23 folder. I click on the file and a command prompt screen flashes and then goes away.
    If anyone could tell me how to use wxPython files properly it would be helpful. I pretty sure there needs to be some compiling involved but i'm not sure how to do that.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    28
    Rep Power
    0
    I would suggest opening the .py file from the command line.

    Open the command prompt, cd to the python directory, then run the python file. Record any errors generated.

    (It's been a while since I used windows. You may need to enter c:\python23\python yourfile.py to run it.)
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    17
    Rep Power
    0
    Thanks for the help EvilMrHenry, but my problem still continues. i used the command prompt, it gives me an error:

    File "C:\Python23\test.py", line 7
    def _ _init_ _(self, parent, ID, title):
    ^

    SyntaxError: Invalid Syntax

    I'm not sure how to fix the error i've been messing around with the file for a while trying figure out whats wrong.
    I used a tutorial (http://www.onlamp.com/pub/a/python/excerpts/chpt20/wxpython.html?page=2) to write the file. My file is the same as the second code (fig 20-7) written in the tutorial.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    28
    Rep Power
    0
    Originally Posted by WheresTheAnyKey
    Thanks for the help EvilMrHenry, but my problem still continues. i used the command prompt, it gives me an error:

    File "C:\Python23\test.py", line 7
    def _ _init_ _(self, parent, ID, title):
    ^

    SyntaxError: Invalid Syntax

    I'm not sure how to fix the error i've been messing around with the file for a while trying figure out whats wrong.
    I used a tutorial (http://www.onlamp.com/pub/a/python/excerpts/chpt20/wxpython.html?page=2) to write the file. My file is the same as the second code (fig 20-7) written in the tutorial.
    OK, I also get SyntaxError: Invalid Syntax on that code. Where it has _ _, you need __. (Remove the spaces between the underscores.) After I fix that, the code works.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    Originally Posted by WheresTheAnyKey
    Thanks for the help EvilMrHenry, but my problem still continues. i used the command prompt, it gives me an error:

    File "C:\Python23\test.py", line 7
    def _ _init_ _(self, parent, ID, title):
    ^

    SyntaxError: Invalid Syntax

    I'm not sure how to fix the error i've been messing around with the file for a while trying figure out whats wrong.
    Did you cut and paste the code? If so there are there spaces between the underscore characters, which should not be there. Another probable cause is incorrect indentation.
    Cut and paste the class here, and wrap it in [ code] blocks, so we can see what is really happening.

    Dave - The Developers' Coach
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    17
    Rep Power
    0
    I elimnated all the spaces between the "_" and the program works perfectly, even though the tutorial placed spaces between the underscores.
    thanks

IMN logo majestic logo threadwatch logo seochat tools logo