【问题标题】:CGI script error when connecting to sqlite database连接到 sqlite 数据库时出现 CGI 脚本错误
【发布时间】:2016-12-02 15:14:28
【问题描述】:

我有以下 cgi 脚本,它尝试在从用户表单提交按钮时运行 python 代码。

   #!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>'

我正在尝试运行的文件 (myfile.py) 正在尝试连接到 sqlite 数据库。但是,当我运行此代码时,控制台会打印此错误并且脚本根本不会执行。

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

感谢任何有关如何解决此问题的建议。

【问题讨论】:

    标签: python sqlite cgi


    【解决方案1】:

    好的。我认为这可能对有类似问题的人有用。我通过包含两者来使其工作

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

    在我的脚本开头。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-09
      • 1970-01-01
      • 2019-04-19
      • 2019-01-08
      • 2022-01-23
      • 1970-01-01
      • 1970-01-01
      • 2016-10-26
      相关资源
      最近更新 更多