V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
sunway1988
V2EX  ›  Python

Python commands.getstatusoutput 一直不退出,求教!

  •  
  •   sunway1988 · 2016-01-07 16:02:47 +08:00 · 5712 次点击
    这是一个创建于 3040 天前的主题,其中的信息可能已经有所发展或是发生改变。

    使用Python commands.getstatusoutput执行Shell 命令,比如执行sh test.sh,通过ps -ef确认sh test.sh已经执行结束,但是commands.getstatusoutput却一直迟迟不退出,Ctrl + C后得到 Traceback 如下:
    File "upgrade_client.py", line 456, in call_setup_script
    status, output = commands.getstatusoutput(command.format(setup=setup))
    File "/usr/lib/python2.7/commands.py", line 60, in getstatusoutput
    text = pipe.read()

    得知程序卡在了 pipe.read(),求教这是什么原因?多谢!

    2 条回复    2018-10-01 11:04:58 +08:00
    lishuai860113
        1
    lishuai860113  
       2018-10-01 10:50:08 +08:00
    同学你这个问题解决了么?今天刚遇到同样的问题
    lishuai860113
        2
    lishuai860113  
       2018-10-01 11:04:58 +08:00
    @lishuai860113 我自问自答下,我自己的问题是 TNND 我命令输出不停,所以 pipe read 没完
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2456 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 08:39 · PVG 16:39 · LAX 01:39 · JFK 04:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.