I am running a python file in the directory where the file is and I get 'No such file or directory', with ls -l the file appears with the needed 'x' permission; my command is ./filename.py + options > name of output file
Thank you for your comments. The error resulted because I was using the upper arrow to find a cmd that I used in an earlier version and, even though the recovered cmd read good in the terminal window, the code won't run. By retyping anew the same cmd it worked fine! I think that the corrupted cmd was the result of an ubuntu error (indicated to me by ubuntu) as startup after I put the system to sleep the day before. I think this is the reason because it happened again, and only retyping the cmd anew resolved the problem. Somehow I have problems every time I startup after I put the system to sleep (the corruption of cmd stored by ubuntu do not happen if I startup from a full shut down).
83 Answers
The error resulted because I was using the upper arrow to find a cmd that I used in an earlier run and, even though the recovered cmd read good in the terminal window, the code won't run. By retyping anew the same cmd it worked fine! I think that the corrupted cmd was the result of an ubuntu error (indicated to me by ubuntu) as startup after I put the system to hivernation the day before. I think this is the reason because it happened again, and only retyping the cmd anew resolved the problem. Somehow I have problems every time I startup after I put the system to sleep (the corruption of cmd stored by ubuntu do not happen if I startup from a full shut down).
Try running it with
python filename.pyOr
python3 filename.pyYou may need sudo depending on the file.
EDIT: usually the ./ is used for bash scripts
7Since you're running it with ./, you may need to prepend
#!/usr/bin/env pythonTo your Python file.
If you would like to avoid that, you could just run the file with python instead:
python script.py