By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,818 Members | 1,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,818 IT Pros & Developers. It's quick & easy.

Running a Python Script via PuTTY

P: 22
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
Share this Question
Share on Google+
6 Replies


bvdet
Expert Mod 2.5K+
P: 2,851
At the command line, did you type in:
python path/verification.py
??
Jul 15 '09 #2

P: 22
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
Expert Mod 2.5K+
P: 2,851
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

P: 22
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
Expert Mod 2.5K+
P: 2,851
Most Python code is not platform dependent. PuTTY is available for Windows and Unix platforms.

-BV
Jul 17 '09 #6

P: 1
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.