V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · Jan 7, 2016 · 6553 views
    This topic created in 3766 days ago, the information mentioned may be changed or developed.

    使用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 replies    2018-10-01 11:04:58 +08:00
    lishuai860113
        1
    lishuai860113  
       Oct 1, 2018
    同学你这个问题解决了么?今天刚遇到同样的问题
    lishuai860113
        2
    lishuai860113  
       Oct 1, 2018
    @lishuai860113 我自问自答下,我自己的问题是 TNND 我命令输出不停,所以 pipe read 没完
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   811 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 20:57 · PVG 04:57 · LAX 13:57 · JFK 16:57
    ♥ Do have faith in what you're doing.