New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examine handling of u
option (Unbuffered stdio)
#1441
Comments
This comment has been minimized.
This comment has been minimized.
I haven't looked at this much because I think it's a very low priority. Windows users generally create GUI apps and don't care much about the terminal output, which is probably why nobody has complained about it.
|
Actually it's a bit trickier than that. On Python 2, python relies on the buffering of the underlying |
This comment has been minimized.
This comment has been minimized.
This does not seem to have any priority to anybody, thus I'm removing it from the milestones plan. |
This is an issue for me. I'm on windows. I have two python programs built with pyinstaller. I'm trying to run one of them as a subprocess of the other one, and monitor the real time output of the subprocess via a PIPE. Because the stdout is always buffered regardless of the -u option, I can't communicate between the two processes in real time. @codewarrior0 - Is the code snippet you pasted above valid for python 2? If so, where exactly could I stick that to makes things work? |
I've created a As mentioned here, I've added After that I'm creating a docker image which will use the above package to start. But I've no idea whether the server has started or not unless I hit any request when it shows Is the unbuffered option works here. If not what can I do to make it work ? |
One needs to learn how Python 2.7, 3.4, 3.5, 3.6 and 3.7 handle this option in Python's C-code. Then one needs to provide a pull-request. |
Pinging. |
I am encountering this issue as well. |
It would be helpful to remove the 'u' runtime option from the documentation if it is not working or clarify the subset of conditions under which it works. The current documentation is very misleading given that this appears to be functionally not yet implemented. |
@jharrang Pull request welcome :-) |
@htgoebel - Perhaps you unintentionally missed the point? I'm not suggesting that this needs to be implemented. While that would be great, it's obviously not been a priority. What should be a high priority and is an easy fix would be updating the documentation to better reflect the current state of the package. I am not sufficiently well-versed in the history of this issue or the current state of the codebase to make that revision, but I'm happy to open a new issue so that it can be assigned to someone who is if you prefer. Thanks! |
@jharrang Even for the documentation a pull-request is welcome. Or for the "Known issues section of the Changelog". |
The relevant issue pyinstaller#1441 which will maybe provide a fix in the future is linked.
…ndows. The relevant issue pyinstaller#1441 which will maybe provide a fix in the future is linked.
Same problem here. Would love to see a fix for this. |
In
pyi_pylib_set_runtime_opts
, we handle theu
option by callingsetbuf
and_setmode
on the stdio streams. This is probably a complete no-op on Windows. These set the buffering options for the stdio of the C Run-time library (CRT) that is linked to the bootloader, but the Python DLL is linked to a different version of the CRT. It will create its own stdio streams wrapping the underlying WindowsHANDLE
s, and theHANDLE
s themselves have no such buffering.We need to get the CRT functions and stdio objects that the Python DLL is linked to in order to change the buffering mode, or else find a way to change the buffering mode through Python API calls or executing Python code.
The text was updated successfully, but these errors were encountered: