Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

buffer control with pyinstaller #782

Closed
tuguldurs opened this issue Jan 17, 2022 · 1 comment
Closed

buffer control with pyinstaller #782

tuguldurs opened this issue Jan 17, 2022 · 1 comment

Comments

@tuguldurs
Copy link

thanks for creating this awesome tool!

What is the best way to enforce constant flushing in python-3 if I have console=False in my Pyinstaller spec file? In particular, I am using the progress bar package tqdm and wanted to have the real-time progress displayed during the computation.

I saw an older post that points out the fact that -u flag never makes it to the interpreter and suggests to do:

  nonbuffered_stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
  sys.stdout = nonbuffered_stdout

which perhaps should be handled in python-3 as (?):

sys.stdout = io.TextIOWrapper(open(sys.stdout.fileno(), 'wb', 0), write_through=True)

But here the trouble is that with console=False (in my spec file), sys.stdout becomes a NullWriter and sys.__stdout__ becomes None, and so I can't for example call .fileno() method. I've also tried just setting PYTHONUNBUFFERED environmental variable to a non-empty string, but it doesn't affect anything since -u doesn't make it to the interpreter.

  • [Windows-10] OS
  • [3.9.2] Python Version
  • [1.0.8] Gooey Version
  • [4.8.1] Pyinstaller

thank you for your time!

@chriskiehl
Copy link
Owner

Howdy!

Unfortunately, I'm not totally sure what the best practice is these days for PyInstaller + the specific Python / OS versions. I'd suggest opening a ticket against the PyInstaller peeps for guidance. It seems to be a constantly evolving art : (

Closing this in favor of the Big List of PyInstaller Issues here. Feel free to comment there. People have had good luck working through the issues in that thread.

Cheers!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants