I am using Ubuntu 12.04.
Hi I have been working on the following issue for a couple of days and as much as a I look at the many different answers (What is PATH environment variable and how to add it) I cannot make them work. I would be extremely grateful if anyone could detail me the required steps for a basic Ubuntu user:
I have Eclipse installed in my Dropbox folder and I have some Python
.py files on it.
I have managed to add this folder to the path and now when I execute:
I can see (among others) my folder with the python codes.
However when I try to run these files from any other folder:
$ python HelloWorld.py
python: can't open file 'HelloWorld.py': [Errno 2] No such file or directory
The solutions described below provide the main steps to make this work:
1) Add to your python scripts (.py) The "shebang" line
This must be the FIRST line in your code.
2) Go to the folder where the python script is located and source it:
chmod +x yourscript.py
Once it is done you can run it from any folder (and the auto-complete will work). Incidentally, (this works in eclipse) if you duplicate an executable script within the editor, you can clear it and rename it and it shall remain executable. So you can avoid step two.