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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old December 5th, 2003, 09:15 PM
KnowNothing KnowNothing is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Nowhere New York
Posts: 46 KnowNothing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to KnowNothing
Problems making code executable

So far I've tryed chmod [path/file], chmod +x [path/file], changing the code from txt to .py thats the only thing I've found elsewhere to change it and it hasn't worked. If you need my code it looks like this...

#!/usr/installs/Python-2.3.2/Python
print "Hello world!"
raw_input("Press any key to continue...")

Reply With Quote
  #2  
Old December 6th, 2003, 12:06 AM
lazy_yogi lazy_yogi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 325 lazy_yogi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 58 m 36 sec
Reputation Power: 6
What's the error you get ?

Reply With Quote
  #3  
Old December 6th, 2003, 09:49 AM
KnowNothing KnowNothing is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Nowhere New York
Posts: 46 KnowNothing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to KnowNothing
here is some more trys and the errors I got


root@darkstar:~# chmod 777 /usr/installs/Python-2.3.2/python hw
chmod: failed to get attributes of `hw': No such file or directory
root@darkstar:~# chmod 777 /usr/installs/Python-2.3.2/python hw.py
chmod: failed to get attributes of `hw.py': No such file or directory
root@darkstar:~# chmod 777 /usr/installs/Python-2.3.2/python /usr/installs/Python-2.3.2/Projects/hw
root@darkstar:~# chmod 777 /usr/installs/Python-2.3.2/python /usr/installs/Python-2.3.2/Projects/hw.py
root@darkstar:~# cd /usr/installs/Python-2.3.2/Projects
root@darkstar:/usr/installs/Python-2.3.2/Projects# ./hw.py
./hw.py: line 1: print: command not found
./hw.py: line 2: syntax error near unexpected token `"Press any key to continue..."'
./hw.py: line 2: `raw_input("Press any key to continue...")'
root@darkstar:/usr/installs/Python-2.3.2/Projects# chmod 777 /usr/installs/Python-2.3.2/python /usr/installs/Python-2.3.2/Projects/helloworld
root@darkstar:/usr/installs/Python-2.3.2/Projects# ./helloworld
-bash: ./helloworld: /usr/installs/Python-2.3.2/Python: bad interpreter: Permission denied
root@darkstar:/usr/installs/Python-2.3.2/Projects# chmod 777 /usr/installs/Python-2.3.2/python /usr/installs/Python-2.3.2/Projects/helloworld.py
root@darkstar:/usr/installs/Python-2.3.2/Projects# ./helloworld.py
-bash: ./helloworld.py: /usr/installs/Python-2.3.2/Python: bad interpreter: Permission denied
root@darkstar:/usr/installs/Python-2.3.2/Projects#

Reply With Quote
  #4  
Old December 8th, 2003, 07:36 PM
oxygenthief oxygenthief is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 35 oxygenthief User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Those are all syntax errors you're getting--try this CD'ing to the directory where the hw.py file is located, then try:

chmod 775 hw.py

Then, try running:

./hw.py

Also, I'm curious about your python path in your first line of code. At the command prompt, type:

which python

The first line of your script should be #! followed by the path spit back by "which python", no spaces.

Reply With Quote
  #5  
Old December 10th, 2003, 02:44 PM
KnowNothing KnowNothing is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Nowhere New York
Posts: 46 KnowNothing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to KnowNothing
root@darkstar:~# cd /usr/installs/Python/Projects
root@darkstar:/usr/installs/Python/Projects# chmod 775 helloworld.py
root@darkstar:/usr/installs/Python/Projects# ./helloworld.py
Hello world!
Press any key to continue...
root@darkstar:/usr/installs/Python/Projects#

Minor victory cause I got it to do something finally, but now how can I get it to do it without going into the konsole. Like when I double click it, it will make a new window and run that, or will I have to setup some kind of GUI for it through a different program?

Reply With Quote
  #6  
Old December 11th, 2003, 04:05 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 7
Send a message via MSN to Grim Archon
Know , try this
Code:
#!/usr/installs/Python-2.3.2/Python
#pgui.py
import Tkinter
hello=Tkinter.Label(None, text="Hello GUI world")
hello.pack()
hello.mainloop()
>chmod +x pygui.py
>pygui.py &
Will run pygui.py in the background and create the GUI.
Grim

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Problems making code executable


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 2 hosted by Hostway