471,324 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,324 software developers and data experts.

Running a Python Script via PuTTY

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.

Jul 15 '09 #1
6 28844
2,851 Expert Mod 2GB
At the command line, did you type in:
python path/verification.py
Jul 15 '09 #2
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
Jul 15 '09 #3
2,851 Expert Mod 2GB
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.
Jul 15 '09 #4
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?
Jul 17 '09 #5
2,851 Expert Mod 2GB
Most Python code is not platform dependent. PuTTY is available for Windows and Unix platforms.

Jul 17 '09 #6
There are two ways to doing it.
Method 1
First make the script executable
chmod u+x <script>.py

Method 2
Python -v <script>.py
Oct 24 '14 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by xunil | last post: by
8 posts views Thread by Harlin Seritt | last post: by
2 posts views Thread by Benjamin Rutt | last post: by
11 posts views Thread by volcano | last post: by
1 post views Thread by Aspersieman | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.