468,549 Members | 2,199 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,549 developers. It's quick & easy.

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.

Thanks!
Jul 15 '09 #1
6 26193
bvdet
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
bvdet
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
bvdet
2,851 Expert Mod 2GB
Most Python code is not platform dependent. PuTTY is available for Windows and Unix platforms.

-BV
Jul 17 '09 #6
There are two ways to doing it.
Method 1
First make the script executable
chmod u+x <script>.py
./<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
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.