1

I'm programming a GUI for pyinstaller. As part of the GUI, I would like to redirect the output of running PyInstaller.__main__.run(['--onefile', 'foo.py']) to a wx.TextCtrl.

I first went about this by writing a class StdoutRedirector:

class StdoutRedirector(object):

    def __init__(self, outputwidget):
        self.out = outputwidget

    def write(self, text):
        self.out.WriteText(text)

Now this works fine for use with the print statement, but not with pyinstaller, which still prints to the terminal. Now I know pyinstaller uses the logger module for output, but I thought that went through sys.stdout.

Can anybody help me solve how to redirect this output to a textctrl widget?

  • Have you tried this? https://stackoverflow.com/questions/1996518/retrieving-the-output-of-subprocess-call – Dan A.S. Oct 01 '19 at 14:19
  • Yes and no - I want to call this from python code direct, and I've figured this out, but currently involves threads and lots more + will post code soon –  Oct 08 '19 at 10:23

0 Answers0