How to execute the python script using the cmd line in linux...?
Hi LQ Members,
I am completely new to python and executing the scripts using the cmd line is creating a prob to me. Could please any 1 help me out. I write the code and save it as prog1.py using gedit of ubuntu. Now i try to execute it as: $ chmod +x prog1.py $python prog1.py but all the time it throws me a syntax invalid error. Please help me regarding this. Thanks & Regards, Archana |
Showing us the actual error would be of help.
|
Hi Grail,
The following is the error it displays when I try to execute the code:- # /usr/bin/python Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> chmod +x apple.py File "<stdin>", line 1 chmod +x apple.py ^ SyntaxError: invalid syntax Please help me sort this problem. Thanks & Regards, Archana. |
YOu have to launch those commands in Bash, not the Python interpreter. Try them again, without launching Python before.
|
Thanks for your guidance and solution TobiSGD!
Regards, Archana |
Remember to mark as SOLVED once you have a solution.
|
All times are GMT -5. The time now is 03:29 AM. |