Ann
Ann

Reputation: 413

CGI script error when connecting to sqlite database

I have the following cgi script which tries to run a python code upon button submit from a user form.

   #!home/ann/anaconda2/lib/python2.7

   print "Content-type:text/html\r\n\r\n"
   print '<html>'
   print '<head>'
   print '<title>First CGI Program</title>'
   print '</head>'
   print '<body>'
   print '<form action="./myfile.py" method="get">'
   print '<p> Click here: <button type="submit">submit</button>'
   print '</form>'
   print '</body>'
   print '</html>'

The file which i'm trying to run (myfile.py) is trying to connect to sqlite database. However when I run this code console prints this error and script doesn't execute at all.

   File "/home/ann/anaconda2/lib/python2.7/CGIHTTPServer.py", line  248, in run_cgi
   os.execve(scriptfile, args, env)
   OSError: [Errno 13] Permission denied

Any advice on how to solve this is appreciated.

Upvotes: 0

Views: 286

Answers (1)

Ann
Ann

Reputation: 413

Ok. I think this might be useful for people with similar issues. I made it work by including both

      #!usr/bin/env python
      #!home/ann/anaconda2/lib/python2.7 

at the beginning of my script.

Upvotes: 1

Related Questions