Skip to content
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

ANSI reset code is printed on Windows on program exit #49

Open
msiemens opened this issue Apr 17, 2015 · 3 comments
Open

ANSI reset code is printed on Windows on program exit #49

msiemens opened this issue Apr 17, 2015 · 3 comments
Labels

Comments

@msiemens
Copy link

Given the following Python file:

import colorama
colorama.init()

Running it results in this:

C:\Users\markus\tmp>python test.py
←[0m
C:\Users\markus\tmp>

This is the result of running initialise.reset_all when exiting the script. The AnsiToWin32 instance that is created isn't instructed to convert ANSI codes, so it just prints the ANSI reset code.

@wiggin15
Copy link
Collaborator

This seems to be related to your issue, #48. It doesn't happen on environments without TERM set...

I see that TERM causes problems for some users, and I'm trying to think if there's a way to change this. It's necessary to make colorama work on terminal emulators under Windows. Why do you have TERM set on cmd?

@msiemens
Copy link
Author

It doesn't happen on environments without TERM set...

Oh, that's interesting. Then my patch in #50 is propably wrong as the problem seems to be in another place. I'll try to debug this in the next days.

Why do you have TERM set on cmd?

For me, I happened to have TERM set because otherwise git would complain about the terminal not being fully functional (see for example http://stackoverflow.com/q/7949956/997063).

@Phyks
Copy link

Phyks commented Apr 29, 2015

No TERM variable set for me, and I have the same problem (in both cmd and Powershell).

After some tests, it seems that deinit() of colorama is happening before reset_all() which means that the reset code will be output directly to the terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants