在cgi脚本中调用os的奇怪行为 [英] Strange behavior with os call in cgi script

查看:66
本文介绍了在cgi脚本中调用os的奇怪行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用

os.environ [''QUERY_STRING''模拟一些cgi输入时,我写了一个cgi脚本似乎从

命令行完美运行]。


当我从浏览器运行它时,我的一个os.system

调用,在运行程序时被罚款得很好在

翻译中,似乎没有得到解决,或者得到了很大的帮助,但确实没有什么。


有没有人知道发生了什么或者我如何调试这个问题?


值得注意的是脚本中的其他os.system调用得到了

罚款。

I have written a cgi script that seems to run perfectly from the
command line when I simulate some cgi input using
os.environ[''QUERY_STRING''].

The thing is that when I run it from the browser, one of my os.system
calls, which gets excecuted fine when running the program in the
interpreter, doesn''t seem to get excecuted, or gets excecuted but does
nothing.

Does anyone know whats going on or how I could debug this problem?

It is worth noting that other os.system calls in the script get
excecuted fine.

推荐答案

sophie_newbie schrieb:
sophie_newbie schrieb:
我写了一个cgi脚本,似乎从 os.environ [''QUERY_STRING'']模拟一些cgi输入时命令行。

当我从浏览器运行它时,我的一个o s.system
调用,在
解释器中运行程序时会被罚款,但似乎没有被激活,或者被激活但是什么也没有。
<有谁知道发生了什么或者我如何调试这个问题?
[...]
I have written a cgi script that seems to run perfectly from the
command line when I simulate some cgi input using
os.environ[''QUERY_STRING''].

The thing is that when I run it from the browser, one of my os.system
calls, which gets excecuted fine when running the program in the
interpreter, doesn''t seem to get excecuted, or gets excecuted but does
nothing.

Does anyone know whats going on or how I could debug this problem?
[...]




你的程序可能环境不同由您的网络服务器执行

。所以要么PATH错了而且找不到你的程序

或其他一些环境变量是错误的你可以通过

在程序中打印环境进行调试。



Probably the environment is different when your program is executed by
your web server. So either PATH is wrong and your program is not found
or some other environment variable is wrong and you could debug it by
printing the environment in your program.


好的,有趣的,但是我在

计划中如何打印环境?

OK, interesting, but just how dow I print he environment in the
program??

< br>

sophie_newbie:
sophie_newbie:
好的,有趣的,但是我在
程序中如何打印环境?
OK, interesting, but just how dow I print he environment in the
program??




在程序中添加日志记录:
http://www.python.org/doc/2.3.5/lib/module-logging.html

并记录环境:
http://www.python.org /dev/doc/newsty...-procinfo.html

-
$ b $bRenéPijlman



Add logging to your program:
http://www.python.org/doc/2.3.5/lib/module-logging.html

And log the environment:
http://www.python.org/dev/doc/newsty...-procinfo.html

--
René Pijlman


这篇关于在cgi脚本中调用os的奇怪行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆