Connecting Tech Pros Worldwide Forums | Help | Site Map

Running a Python Script via PuTTY

Newbie
 
Join Date: Jul 2009
Posts: 22
#1: Jul 15 '09
I wrote a python script and I have copied my file (verification.py) into my http directory. However, when I try to run the script I get many errors...

Expand|Select|Wrap|Line Numbers
  1. ..
  2. : No such file or directoryline 1: #!/usr/bin/python
  3. : command not foundect.py: line 3:
  4. ./Verification_Project.py: line 4: from: command not found
  5. : command not foundect.py: line 5:
  6. ./Verification_Project.py: line 6: from: command not found
  7. import: unable to open X server `'.
  8. import: unable to open X server `'.
  9. import: unable to open X server `'.
  10. import: unable to open X server `'.
  11. import: unable to open X server `'.
  12. import: unable to open X server `'.
  13. import: unable to open X server `'.
  14. import: unable to open X server `'.
  15. ./Verification_Project.py: line 15: from: command not found
  16. import: unable to open X server `'.
  17. : command not foundect.py: line 19:
  18. ./Verification_Project.py: line 20: syntax error near unexpected token `('
  19. '/Verification_Project.py: line 20: `today = datetime.date.today()
  20. ..
I am not sure why I am getting these errors because when I run the script in Python it works fine.

Thanks!

bvdet's Avatar
Moderator
 
Join Date: Oct 2006
Location: Nashville, TN
Posts: 1,566
#2: Jul 15 '09

re: Running a Python Script via PuTTY


At the command line, did you type in:
python path/verification.py
??
Newbie
 
Join Date: Jul 2009
Posts: 22
#3: Jul 15 '09

re: Running a Python Script via PuTTY


Initially, no I did not, I typed ./Verification.py
However, I just tried that from my http directory which is where the file is located and it said

python: can't open file 'path/Verification_Project.py': [Errno 2] No such file or directory
bvdet's Avatar
Moderator
 
Join Date: Oct 2006
Location: Nashville, TN
Posts: 1,566
#4: Jul 15 '09

re: Running a Python Script via PuTTY


From your HTTP directory, try typing in python Verification.py. When I posted python path/Verification.py, I did not mean path literally, but the actual path to your file on your system. You may also need the path to the python interpreter.
Newbie
 
Join Date: Jul 2009
Posts: 22
#5: Jul 17 '09

re: Running a Python Script via PuTTY


I wrote my python script in windows, however I need to convert it so that it will run on a linux computer. Do you know how I would convert from windows to linux?
bvdet's Avatar
Moderator
 
Join Date: Oct 2006
Location: Nashville, TN
Posts: 1,566
#6: Jul 17 '09

re: Running a Python Script via PuTTY


Most Python code is not platform dependent. PuTTY is available for Windows and Unix platforms.

-BV
Reply