-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[BUG] Progress bar data is not piped when a script using rich is run in a subprocess #2326
Comments
Rich will strip anything dynamic when it detects it is not writing to a console. If you don't want this you can force it to behave as a terminal with |
Thanks for the response. For now, I will use a pseudo-terminal, and I will see if the pip team is open to making force_terminal an option. |
Did I solve your problem? Why not buy the devs a coffee to say thanks? |
@willmcgugan sorry to revive this issue, but is there any chance you'd consider adding the ability to use an environment variable to force this instead of needing to change every codebase that uses rich? |
Potentially. See pypa/pip#10909 for background |
Describe the bug
Progress bar updates are not piped via stdout when running any script that uses rich in a subprocess. I specifically noticed this when trying to parse the progress bar of a pip install (pip uses rich for its progress bar), when I noticed that it only pipes the data of the final (finished) bar, and none of the updates.
This stack overflow post I found describes the issue in slightly more detail and provides a minimal repro. They mention using python's Popen, but the same thing happens in nodejs's child_process.spawn function.
Here's an example of what it outputs:
And what I would expect it to output:
Platform
Windows
P.S. Please don't tell me not to run pip install commands this way. I have a specific use case and it will be a waste of time to argue about this. This is a general issue that extends far beyond pip, and I'm sure being able to parse progress bars from scripts is helpful to more people than just me.
The text was updated successfully, but these errors were encountered: