久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='2Qz7x'><style id='2Qz7x'><dir id='2Qz7x'><q id='2Qz7x'></q></dir></style></legend>
  • <i id='2Qz7x'><tr id='2Qz7x'><dt id='2Qz7x'><q id='2Qz7x'><span id='2Qz7x'><b id='2Qz7x'><form id='2Qz7x'><ins id='2Qz7x'></ins><ul id='2Qz7x'></ul><sub id='2Qz7x'></sub></form><legend id='2Qz7x'></legend><bdo id='2Qz7x'><pre id='2Qz7x'><center id='2Qz7x'></center></pre></bdo></b><th id='2Qz7x'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2Qz7x'><tfoot id='2Qz7x'></tfoot><dl id='2Qz7x'><fieldset id='2Qz7x'></fieldset></dl></div>

        <small id='2Qz7x'></small><noframes id='2Qz7x'>

      1. <tfoot id='2Qz7x'></tfoot>
        • <bdo id='2Qz7x'></bdo><ul id='2Qz7x'></ul>

      2. 在子進程中運行 Pyinstaller 單個可執行輸出時無法

        Cannot redirect Pyinstaller single executable output while running it in subprocess(在子進程中運行 Pyinstaller 單個可執行輸出時無法重定向它)
        <i id='FomUS'><tr id='FomUS'><dt id='FomUS'><q id='FomUS'><span id='FomUS'><b id='FomUS'><form id='FomUS'><ins id='FomUS'></ins><ul id='FomUS'></ul><sub id='FomUS'></sub></form><legend id='FomUS'></legend><bdo id='FomUS'><pre id='FomUS'><center id='FomUS'></center></pre></bdo></b><th id='FomUS'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FomUS'><tfoot id='FomUS'></tfoot><dl id='FomUS'><fieldset id='FomUS'></fieldset></dl></div>

          • <small id='FomUS'></small><noframes id='FomUS'>

            1. <legend id='FomUS'><style id='FomUS'><dir id='FomUS'><q id='FomUS'></q></dir></style></legend>

              <tfoot id='FomUS'></tfoot>

                <bdo id='FomUS'></bdo><ul id='FomUS'></ul>
                  <tbody id='FomUS'></tbody>

                1. 本文介紹了在子進程中運行 Pyinstaller 單個可執行輸出時無法重定向它的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我已經為此苦苦掙扎了一段時間.我已經設法編寫了一個可以捕獲 .py 文件的 STDOUT 的代碼,但是當我使用從 Pyinstaller 生成的可執行文件運行完全相同的代碼時(不管它是否窗口化)readyReadStandardOutput 信號永遠不會出現.

                  I've been struggling with this for quite a while. I've managed to write a code that can capture STDOUT of .py files, however when I run the exact same code with executable generated from Pyinstaller (doesn't matter whether it's windowed or not) the readyReadStandardOutput signal doesn't ever come up.

                  根據我的測試,只有在應用程序崩潰時才會發出任何信號,但是我需要 GUI 和可執行文件之間的實時通信.

                  From my tests it occurs that any signal at all is emitted only when the app crashes, however I need a live communication between the GUI and the executable.

                  這是我的參考代碼:

                    def start_process(self, program, args=None):
                          if args is None:
                              args = []
                  
                          process = QtCore.QProcess(self)
                          process.readyReadStandardOutput.connect(partial(self.onReadyReadStandardOutput, self.number_process_running))
                  
                          process.start(program)
                  

                  以及我將信號連接到的方法:

                  and the method that I've connected the signal to:

                      def onReadyReadStandardOutput(self, i):
                          print("called")
                          process = self.sender()
                          self.results[i] = process.readAllStandardOutput()
                          self.resultsChanged.emit(self.results)
                  

                  我正在使用 Windows 機器

                  I'm working on a Windows machine

                  最小的可重現示例

                  我們來寫一個小腳本

                  import time
                  
                  if __name__ == "__main__":
                      num = 0
                      while True:
                          num = num + 1
                          print(num)
                          time.sleep(3)
                  

                  讓我們暫時離開 PyQT 進程并使用更簡單的 Popen.如果我們在 Popen 中運行腳本,stdout 將被重定向到調用進程.

                  Let's leave the PyQT processes for now and use simpler Popen. If we run the script in Popen, the stdout will be redirected to the calling process.

                  if __name__ == '__main__':
                      p = Popen([r'python', 'test.py'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
                      while p.poll() is None:
                          out = p.stdout.readline()
                          print(out)
                  

                  但是,如果我們使用第一個腳本并通過 PyInstaller 單個可執行文件生成器,Popen 將不再捕獲任何輸出,它只會凍結

                  However, if we take the first script and put through PyInstaller single executable generator, the Popen won't capture any output no more, it will just freeze

                  import os
                  import sys
                  
                  import PyInstaller.__main__
                  
                  file_location = os.path.dirname(os.path.realpath(__file__))
                  
                  if sys.platform == "win32":
                      PyInstaller.__main__.run([
                          '--name=%s' % 'test',
                          '--onefile',
                          '--noconsole',
                          '--distpath=%s' % os.path.join(file_location, 'dist'),
                          '--workpath=%s' % os.path.join(file_location, 'build'),
                          '--specpath=%s' % os.path.join(file_location),
                          os.path.join(file_location, 'test.py'),
                      ])
                  

                  所以我的問題是 - 我錯過了其中的一些重要部分嗎?或者也許這只是 pyinstaller 的錯.

                  So again my question is - am I missing some important part in there? Or maybe it's just pyinstaller's fault.

                  推薦答案

                  看來你在編譯腳本的時候應該把print的flush設置為True,所以改成:

                  It seems that when you compile the script you should set the flush of the print to True, so just change it to:

                  import time
                  
                  if __name__ == "__main__":
                      num = 0
                      while True:
                          num = num + 1
                          print(num, flush=True)
                          time.sleep(3)

                  這篇關于在子進程中運行 Pyinstaller 單個可執行輸出時無法重定向它的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

                    <bdo id='Rqg98'></bdo><ul id='Rqg98'></ul>
                    <tfoot id='Rqg98'></tfoot>
                    1. <legend id='Rqg98'><style id='Rqg98'><dir id='Rqg98'><q id='Rqg98'></q></dir></style></legend>
                      <i id='Rqg98'><tr id='Rqg98'><dt id='Rqg98'><q id='Rqg98'><span id='Rqg98'><b id='Rqg98'><form id='Rqg98'><ins id='Rqg98'></ins><ul id='Rqg98'></ul><sub id='Rqg98'></sub></form><legend id='Rqg98'></legend><bdo id='Rqg98'><pre id='Rqg98'><center id='Rqg98'></center></pre></bdo></b><th id='Rqg98'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Rqg98'><tfoot id='Rqg98'></tfoot><dl id='Rqg98'><fieldset id='Rqg98'></fieldset></dl></div>

                          <tbody id='Rqg98'></tbody>

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

                          • 主站蜘蛛池模板: 超碰97免费在线 | 久久精品亚洲成在人线av网址 | 精品久久一区 | 亚洲高清在线观看 | 宅男噜噜噜66一区二区 | 91干b| www.欧美.com| 欧美aaaaaaaaaa | 一起操网站| 国产黄色在线观看 | 国产成人网 | 91精品国产综合久久婷婷香蕉 | 色av一区二区三区 | 成年免费在线观看 | 人人擦人人干 | 91国内视频在线 | 国产日韩欧美 | jlzzjlzz国产精品久久 | 亚洲网站观看 | 一区二区三区亚洲精品国 | 一区二区视频在线 | 99精品视频在线观看 | 欧美日韩成人网 | 久久国产精品视频 | www.天天操.com | 国产精品av久久久久久久久久 | 99精品国产在热久久 | 精品欧美一区二区三区久久久小说 | 国产精品污www在线观看 | 日韩在线三级 | 中文字幕亚洲精品 | 欧美精品在线观看 | 国产精品久久久久免费 | 91极品视频 | 久草在线 | 免费xxxx大片国产在线 | 亚洲精品自在在线观看 | 亚洲国产成人av好男人在线观看 | 日韩在线播放av | 91亚洲国产成人久久精品网站 | 一区二区免费 |