2007年07月05日 星期四 16:05
一个单独的python 程序, 使用sys.exit(1), 可以把正确的返回值返回给shell 环境
但是当另外一个python 程序使用os.system("./bin/xxx.py") 这样调用的时候, os.system 的返回值却出现了问题,
变成了256 , 也就是0x100 , 不知道这个问题怎么解决?
2007年07月05日 星期四 16:30
os.system('./bin/xxx.py') % 255
在 07-7-5,PianoPan<pianopan在gmail.com> 写道:
> 一个单独的python 程序, 使用sys.exit(1), 可以把正确的返回值返回给shell 环境
>
>
> 但是当另外一个python 程序使用os.system("./bin/xxx.py") 这样调用的时候, os.system 的返回值却出现了问题,
> 变成了256 , 也就是0x100 , 不知道这个问题怎么解决?
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
---
努力學習 Python 中 (沈崴 ...)
http://blog.163.com/eishn
2007年07月05日 星期四 17:32
沈崴 wrote:
> os.system('./bin/xxx.py') % 255
>
> 在 07-7-5,PianoPan<pianopan在gmail.com> 写道:
>
>> 一个单独的python 程序, 使用sys.exit(1), 可以把正确的返回值返回给shell 环境
>>
>>
>> 但是当另外一个python 程序使用os.system("./bin/xxx.py") 这样调用的时候, os.system 的返回值却出现了问题,
>> 变成了256 , 也就是0x100 , 不知道这个问题怎么解决?
>> _______________________________________________
>> python-chinese
>> Post: send python-chinese在lists.python.cn
>> Subscribe: send subscribe to python-chinese-request在lists.python.cn
>> Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
>> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>>
>
> ---
> 努力學習 Python 中 (沈崴 ...)
>
沈啊,我说你是不是*(&$#^&&!
os.system('./bin/xxx.py') % 255
这也行?算了,你还是进军演艺圈吧...
2007年07月05日 星期四 17:56
On 7/5/07, PianoPan <pianopan在gmail.com> wrote: > 一个单独的python 程序, 使用sys.exit(1), 可以把正确的返回值返回给shell 环境 > > > 但是当另外一个python 程序使用os.system("./bin/xxx.py") 这样调用的时候, os.system 的返回值却出现了问题, > 变成了256 , 也就是0x100 , 不知道这个问题怎么解决? unix下,返回值应该是256的。 参见os模块的wait和system函数说明。 exit status indication: 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 is zero); the high bit of the low byte is set if a core file was produced. Availability: Macintosh, Unix. -- Best Regards, Leo Jay
Zeuux © 2025
京ICP备05028076号