-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Tools with colorama cannot be automated within Pycharm #307
Comments
This is the fix you probably need - #230 I'm kind of with you on detecting that env var for Pycharm, but it probably is the easiest solution as emulating ttys can be a bit flakey |
i-keliukh
added a commit
to Samsung/Universum
that referenced
this issue
Aug 19, 2022
The failure is caused by colorama package producing excessive output at the process termination. The additional output leads to error when parsing json. Details: 1. PyCQA/isort#1657 2. tartley/colorama#307
i-keliukh
added a commit
to Samsung/Universum
that referenced
this issue
Aug 19, 2022
The failure is caused by colorama package producing excessive output at the process termination. The additional output leads to error when parsing json. Details: 1. PyCQA/isort#1657 2. tartley/colorama#307
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
the detection of Pycharm introduced in #107 / #108 / #163 has some false-positives -- it actually should only determine whether the current script's output is redirected to a Pycharm Console Windows. However, the environment variable used is inherited for any subprocess, causing output redirected to other tools (xxd here) to be skewed:
Given the following scenario:
In this scenario, I'd like to debug mytestsuite.py -- however, since it is running in Pycharm, coloredtool.py suddenly starts to output ANSI escapes in its stdout, and causes somewebserver.py to fail, which makes debugging any software like mytestsuite.py with any indirect dependencies to colorama rather hard. Even identifying the issue of this sudden and unexpected malfunction of the webserver can be quite time-consuming.
I'd suggest removing the detection of the PYCHARM_HOSTED variable -- I'm not sure if the Pycharm option is new; but PyCharm can optionally emulate a TTY if required, which causes os.isatty (on Ubuntu) to return true for stdin/stdout/stderr on the single TTY actually connected to Pycharm. This way, all other tools not connected directly to the Pycharm window can output unformatted text as expected; and users of colorama still can use formatting within Pycharm, if they change their run/debug configuration accordingly.
The text was updated successfully, but these errors were encountered: