推荐学习书目
› 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
pppguest3962
V2EX  ›  Python

Win 环境,如何非阻塞运行一个 windows 命令?

  •  
  •   pppguest3962 · Aug 16, 2022 · 3064 views
    This topic created in 1507 days ago, the information mentioned may be changed or developed.

    os.system('notepad ' + errsavelogfile) #阻塞
    非阻塞,有何方法?

    5 replies  •  2022-08-16 18:30:40 +08:00
    frostming
        1
    frostming  
       Aug 16, 2022
    subprocess.Popen(['notepad', errsavelogfile])
    cxxnullptr
        2
    cxxnullptr  
       Aug 16, 2022
    放子进程里运行
    zjj19950716
        3
    zjj19950716  
       Aug 16, 2022
    cmd /C start xxxxx
    sazima
        4
    sazima  
       Aug 16, 2022
    loop.run_in_executor
    wwqgtxx
        5
    wwqgtxx  
       Aug 16, 2022
    官方文档都说了多久了别再用 os.system 了,用 subprocess 模块
    https://docs.python.org/3/library/subprocess.html
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2313 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 05:35 · PVG 13:35 · LAX 22:35 · JFK 01:35
    ♥ Do have faith in what you're doing.