python,socket accept返回值发送系统命令,远程服务器os.system()执行功能实现,但返回值是1请问为什么?怎么解决?

The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.2752人阅读
Python(24)
补充一句:如果第三方程序返回的是布尔型返回值,os.system会将true转为1,false转为0进行返回。
下面是转发:
记得老早的时候邮件列表上有朋友问过os.system()的返回值异常的问题。今天又碰到啦,所以总结下。
/bin/xxx.py是一个返回码为1的程序。
当python 程序使用os.system(”./bin/xxx.py”) 这样调用的时候, 成功运行后os.system 的返回值出现了问题,变成了256 ,也就是0×100。而不是正常应该返回的1。
查阅了文档发现
os.system()的返回为:
On Unix, the return value is the exit status of the process encoded in
the format specified for wait().
而os.wait()的返回为:
a 16-bit number, whose low byte is the signal number that killed the
process, and whose high byte is the exit status (if the signal number
os.system的返回值并不是执行程序的返回结果。而是一个16位的数,它的高位才是返回码。也就是说os.system()返回256即 0×0100,返回码应该是其高位0×01即1。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:378694次
积分:4227
积分:4227
排名:第5865名
原创:78篇
转载:168篇
评论:26条
(3)(2)(2)(5)(4)(6)(18)(8)(6)(20)(5)(17)(1)(1)(4)(5)(2)(5)(1)(2)(4)(8)(2)(26)(9)(22)(1)(1)(1)(5)(2)(8)(19)(7)(1)(1)(2)(1)(6)(1)(5)(2)The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.

我要回帖

更多关于 socket send 返回值 的文章

 

随机推荐