-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
Add support for PyCharm #163
Conversation
This change is incredibly simple, and I think it's mostly the intended behavior. PyCharm behaves like a TTY (at least for colorama's intents) so this isolates the changes to one place and in the future if there need to be additional platforms/apps added this would be a reasonable place to do so. |
Ping @tartley. Any chance we could get this pulled in? |
colorama/ansitowin32.py
Outdated
@@ -18,7 +18,8 @@ def is_stream_closed(stream): | |||
|
|||
|
|||
def is_a_tty(stream): | |||
return hasattr(stream, 'isatty') and stream.isatty() | |||
is_pycharm = 'PYCHARM_HOSTED' in os.environ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will look better if we do:
if 'PYCHARM_HOSTED' in os.environ: return True
and then leave the original return as it was. This is not important, though - what do you think?
Looks like the request to support PyCharm is quite popular so let's pull it in. See my comment on the commit. |
@wiggin15 Sounds good to me. Made the change and just pushed it. |
Oops. When I wrote if 'PYCHARM_HOSTED' in os.environ:
return True The one-line works but doesn't look very "pythonic". Sorry for the hassle. |
:) I'm pretty new to python, so I'm not familiar with the standard styles. Fixed! |
Thanks for the pull request! This will be included in the next release of colorama (I'm not sure when it will be released). |
Does this change imply that every stream checked using From what I guess looking at the source code, I'm afraid that using I see two possible solutions:
|
Fixes #107
Replaces the abandoned #108