Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 6th, 2004, 10:47 PM
WheresTheAnyKey WheresTheAnyKey is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 17 WheresTheAnyKey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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.

Reply With Quote
  #2  
Old August 7th, 2004, 02:38 AM
evilmrhenry evilmrhenry is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 28 evilmrhenry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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.)

Reply With Quote
  #3  
Old August 7th, 2004, 12:17 PM
WheresTheAnyKey WheresTheAnyKey is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 17 WheresTheAnyKey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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.

Reply With Quote
  #4  
Old August 7th, 2004, 02:06 PM
evilmrhenry evilmrhenry is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 28 evilmrhenry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
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.

Reply With Quote
  #5  
Old August 7th, 2004, 03:04 PM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,205 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 17 h 39 m 53 sec
Reputation Power: 262
Quote:
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

Reply With Quote
  #6  
Old August 7th, 2004, 04:48 PM
WheresTheAnyKey WheresTheAnyKey is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 17 WheresTheAnyKey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I elimnated all the spaces between the "_" and the program works perfectly, even though the tutorial placed spaces between the underscores.
thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > WxPython ("Python files wont work")


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway