<i id='7d1KW'><tr id='7d1KW'><dt id='7d1KW'><q id='7d1KW'><span id='7d1KW'><b id='7d1KW'><form id='7d1KW'><ins id='7d1KW'></ins><ul id='7d1KW'></ul><sub id='7d1KW'></sub></form><legend id='7d1KW'></legend><bdo id='7d1KW'><pre id='7d1KW'><center id='7d1KW'></center></pre></bdo></b><th id='7d1KW'></th></span></q></dt></tr></i><div id='7d1KW'><tfoot id='7d1KW'></tfoot><dl id='7d1KW'><fieldset id='7d1KW'></fieldset></dl></div>

    <small id='7d1KW'></small><noframes id='7d1KW'>

  1. <legend id='7d1KW'><style id='7d1KW'><dir id='7d1KW'><q id='7d1KW'></q></dir></style></legend><tfoot id='7d1KW'></tfoot>

      • <bdo id='7d1KW'></bdo><ul id='7d1KW'></ul>

      Python 子进程 Popen 与 Pyinstaller

      Python Subprocess Popen with Pyinstaller(Python 子进程 Popen 与 Pyinstaller)

      <i id='D3ejH'><tr id='D3ejH'><dt id='D3ejH'><q id='D3ejH'><span id='D3ejH'><b id='D3ejH'><form id='D3ejH'><ins id='D3ejH'></ins><ul id='D3ejH'></ul><sub id='D3ejH'></sub></form><legend id='D3ejH'></legend><bdo id='D3ejH'><pre id='D3ejH'><center id='D3ejH'></center></pre></bdo></b><th id='D3ejH'></th></span></q></dt></tr></i><div id='D3ejH'><tfoot id='D3ejH'></tfoot><dl id='D3ejH'><fieldset id='D3ejH'></fieldset></dl></div>
        <tbody id='D3ejH'></tbody>

      1. <tfoot id='D3ejH'></tfoot>
          <bdo id='D3ejH'></bdo><ul id='D3ejH'></ul>
            <legend id='D3ejH'><style id='D3ejH'><dir id='D3ejH'><q id='D3ejH'></q></dir></style></legend>
          • <small id='D3ejH'></small><noframes id='D3ejH'>

              • 本文介绍了Python 子进程 Popen 与 Pyinstaller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我使用 ffmpeg 来转换一些视频.我用 subprocess.Popen(...) 调用命令

                I use ffmpeg for converting some videos. I am calling command with subprocess.Popen(...)

                si = subprocess.STARTUPINFO()
                si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                
                self.my_pro = subprocess.Popen(cmd,
                stdin=subprocess.PIPE,
                stderr=subprocess.PIPE,
                startupinfo=si)
                
                (output, error) = self.my_pro.communicate()
                

                我用这个方法杀人

                self.my_pro.kill()
                

                不用编译成exe也没关系.

                It's okey without compile to exe.

                但我使用 pyinstaller 编译,而 --noconsole 子进程不起作用.我必须将 subprocess.Popen(...) 更改为 subprocess.check_output(...)

                But i compiled with pyinstaller with --noconsole subprocess not working. I must change subprocess.Popen(...) to subprocess.check_output(...)

                但是这次我不能用 self.my_pro.kill() 杀死进程,这不起作用.

                But this time i can't kill process with self.my_pro.kill() this not working.

                如何使用 i can kill 运行进程并运行 pyinstaller noconsole?

                How i can run process with i can kill and it will run pyinstaller noconsole?

                推荐答案

                正如@jfs 所写,使用 Popen 您必须重定向所有内容.你忘记了 stdout

                As @jfs wrote, with Popen you have to redirect everything. You forgot stdout

                所以这段代码对我来说不再崩溃了:

                So this code doesn't crash for me anymore:

                si = subprocess.STARTUPINFO()
                si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                
                self.my_pro = subprocess.Popen(cmd,
                stdin=subprocess.PIPE,
                stderr=subprocess.PIPE,
                stdout=subprocess.PIPE,
                startupinfo=si)
                

                这篇关于Python 子进程 Popen 与 Pyinstaller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Initialize Multiple Numpy Arrays (Multiple Assignment) - Like MATLAB deal()(初始化多个 Numpy 数组(多重赋值) - 像 MATLAB deal())
                How to extend Python class init(如何扩展 Python 类初始化)
                What#39;s the difference between dict() and {}?(dict() 和 {} 有什么区别?)
                What is a wrapper_descriptor, and why is Foo.__init__() one in this case?(什么是 wrapper_descriptor,为什么 Foo.__init__() 在这种情况下是其中之一?)
                Initialize list with same bool value(使用相同的布尔值初始化列表)
                setattr with kwargs, pythonic or not?(setattr 与 kwargs,pythonic 与否?)
              • <legend id='XsofX'><style id='XsofX'><dir id='XsofX'><q id='XsofX'></q></dir></style></legend>

                      • <bdo id='XsofX'></bdo><ul id='XsofX'></ul>

                        <small id='XsofX'></small><noframes id='XsofX'>

                          <tbody id='XsofX'></tbody>
                        <tfoot id='XsofX'></tfoot>

                        1. <i id='XsofX'><tr id='XsofX'><dt id='XsofX'><q id='XsofX'><span id='XsofX'><b id='XsofX'><form id='XsofX'><ins id='XsofX'></ins><ul id='XsofX'></ul><sub id='XsofX'></sub></form><legend id='XsofX'></legend><bdo id='XsofX'><pre id='XsofX'><center id='XsofX'></center></pre></bdo></b><th id='XsofX'></th></span></q></dt></tr></i><div id='XsofX'><tfoot id='XsofX'></tfoot><dl id='XsofX'><fieldset id='XsofX'></fieldset></dl></div>