Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File not found error, but file exists

I am working on a simple webapp from Head First Python. I am using ubuntu 14.04. But it is the error:

Traceback (most recent call last):
  File "/usr/lib/python3.4/http/server.py", line 1143, in run_cgi
    os.execve(scriptfile, args, env)
FileNotFoundError: [Errno 2] No such file or directory: 
'/home/sarthak/Desktop/Learn/HeadFirstPython/chapter7/webapp/cgi-bin/generate_list.py'

127.0.0.1 - - [12/Jun/2015 07:08:25] CGI script exit status 0x7f00

The file surely exists on the system and it is made executable.

How to fix the problem?

like image 216
Sarthak Deshwal Avatar asked Oct 19 '22 09:10

Sarthak Deshwal


1 Answers

The Problem lies in the 'wrong' path of the shebang line (the first line which says #!/usr/local/bin/python3) of the generate_list.py file.

If you are using ubuntu the location of python3 is probably /usr/bin/python3 (You can find out your python3 location by typing which python3 into the shell/terminal). So you have to adjust the first line to the actual address of python3 in order to make your script work.

like image 165
mirirai Avatar answered Oct 27 '22 09:10

mirirai