Glam Prestige Journal

Bright entertainment trends with youth appeal.

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).

8

3 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.py

Or

python3 filename.py

You may need sudo depending on the file.

EDIT: usually the ./ is used for bash scripts

7

Since you're running it with ./, you may need to prepend

#!/usr/bin/env python

To your Python file.

If you would like to avoid that, you could just run the file with python instead:

python script.py

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy