-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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] Coloring does not work in PyCharm #206
Comments
It could be a problem with auto-detection. What does the following print in PyCharm?
|
In the PyCharm stdout window, as you've suspected, it prints 'None' (and no color). |
Interesting. That suggest the stdout window is not an embedded console. Rich will disable color if it detects it is not connected to a real terminal. You could try this: console = Console(color_system="windows") That will force Rich to write color, but if PyCharm can't handle it, you may end up with garbage. |
Thanks - it works. Since I only use Windows for this project, this workaround is good enough. Should I submit a bug to PyCharm? |
Might be worth filing a bug report. Tell them that |
@akrk1986 going to close this one, but let me know if you get a response from PyCharm devs... |
Will let you know. Thanks a lot for the quick response and great package! |
Just FYI, bug was accepted by PyCharm: Issue PY-43860 |
Hi Will, |
@akrk1986 Thank you. I have used for the first time and was wondering why no progress bar was visible at all - setting the emulation fixes this. WOuld be great if this is in the docs. |
You're right, please add this to the docs. |
It's on the first page in a blue box. https://rich.readthedocs.io/en/latest/introduction.html |
Thanks 👍🏻 I meant in github but I guess that'll do as well. Out of curiosity, is there no easy way to make it work out of the box? The other libs I used before usually worked in PyCharm without the need for |
Not without breaking things for other users. |
FYI, per https://youtrack.jetbrains.com/issue/PY-29204 it looks IntelliJ removed this feature. There is no such option in version 2021.2.3 and no indication of when it will come back. Are there any other workarounds? I filed a new bug report at https://youtrack.jetbrains.com/issue/PY-51507 |
I'm also unable to make this work in PyCharm in Windows, and unsure how to apply Will's suggestion: console = Console(color_system="windows") |
Hi, In PyCharm 2022.1.3 seems there is no emulate terminal in output console for run configurations. Still have that problem with red logs in the console. Does anyone know how to solve this problem? |
@AntonyMilneQB see https://stackoverflow.com/questions/20333674/pycharm-logging-output-colours. I think if you change your streamhandler to explicitly write to stdout it should get rid of the red logs. |
Emulate terminal works so that we have colors, but it doesnt work as debug console anymore, which is quite annoying ): |
@Liquidmasl unfortunately this is something PyCharm has to fix, not a Textualize issue. |
Just checked - it seems to be a PyCharm problem, I will report it there, so this report is just FYI for rich users who use PyCharm.
It works in the PyCharm terminal (command line), but not inside the stdout pane of PyCharm.
Reproduction
Replace print() statement with console.print(string, style='bold red'). The string is printed, but no coloring.
Windows 10, PyCharm Community (lastest), Python 3.8, Rich 5.0.0
The text was updated successfully, but these errors were encountered: