Open DanZerom opened 1 year ago
What do you get if you run: print(colorama.version)
On Sun, Feb 12, 2023 at 11:58 PM DanZerom @.***> wrote:
I have tried to use this function both on interpreter and pycharm, it doesn't even appear on method menu.
— Reply to this email directly, view it on GitHub https://github.com/tartley/colorama/issues/370, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEU42GQODXWWPVDEEBLYMDWXHSQTANCNFSM6AAAAAAUZ5VDVA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- Nathaniel J. Smith -- https://vorpus.org http://vorpus.org
Hello,
0.4.6
Regards, Daniel.
W dniu poniedziałek, 13 lutego 2023 Nathaniel J. Smith < @.***> napisał(a):
What do you get if you run: print(colorama.version)
On Sun, Feb 12, 2023 at 11:58 PM DanZerom @.***> wrote:
I have tried to use this function both on interpreter and pycharm, it doesn't even appear on method menu.
— Reply to this email directly, view it on GitHub https://github.com/tartley/colorama/issues/370, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAEU42GQODXWWPVDEEBLYMDWXHSQTANCNFSM6AAAAAAUZ5VDVA
. You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- Nathaniel J. Smith -- https://vorpus.org http://vorpus.org
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.< https://ci3.googleusercontent.com/proxy/Xi06WAMZDr0019LgqOL1nniBTIi3bF95EGXmIim6RYDX5UpZme5mq2eqEcpdr_oGhNxpcTWC6iKGEDhYgZ-4zkBbuTRY6jgA1d2n3NsCR453t5i0PZd9nBfew2q3pkLGDQ35CBlfjz9OnuYWhve7frMa74lOaByc6i-t0BWtwCeJo3nWjJa0EAhpqsI-Ey-8BfEo7O9Ryi6EQIwXY69i3KX0f__45rbkx-q-Y9omnbPoNdf25Q=s0-d-e1-ft#https://github.com/notifications/beacon/AZHAY36YCTY7WSYUTE4DONTWXHW5PA5CNFSM6AAAAAAUZ5VDVCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSVC2IY6.gif>Message ID: @.***>
Yes, also hitting this bug. Pylint said just_fix_windows_console was missing. It works when I launch ubuntu docker but I can't launch it locally in windows.
ImportError: cannot import name 'just_fix_windows_console' from 'colorama'
I have to use init() instead and that works fine. I have the latest. Others in stack overflow mention that downgrading works but this doesn't work for me. I have to use init()
Just hit this on my Ubuntu 22 LTS box as well. Again, init()
works fine so I'm able to work around the issue and update my libs that are hitting this.
For what it's worth: A brief look into the sources here and a couple commands in the interpreter gives you YOUR system's answer to the issue:
CHANGELOG.rst
file in the project root.0.4.6 Current release
https://github.com/tartley/colorama/pull/139 Add alternative to init(), called just_fix_windows_console. This fixes many longstanding problems with init, such as working incorrectly on modern Windows terminals, and wonkiness when init gets called multiple times. The intention is that it just makes all Windows terminals treat ANSI the same way as other terminals do. Many thanks to njsmith for fixing our messes.
initialise.py
module of colorama 0.4.6
You can import and run it by using:
>>> from colorama import initialise
>>> initialise.just_fix_windows_console()
just_fix_windows_console()
in the initialise.py
module with some extra comments:global fixed_windows_console
if sys.platform != "win32": # Windows 7 and higher should return TRUE for 'sys.platform == "win32"
return # so if this is you, this function will continue to run
if fixed_windows_console: # This hasn't been determined yet on first execution and is initially set to FALSE
return # So nope, you're still going...
# So here we're asking if there is a valid wrapper to write to (ie. is there a valid object to handle encoding/decoding text
if wrapped_stdout is not None or wrapped_stderr is not None:
# Someone already ran init() and it did stuff, so we won't second-guess them (Colorama comment)
return
# On newer versions of Windows, AnsiToWin32.__init__ will implicitly enable the (Colorama comment)
# native ANSI support in the console as a side-effect. We only need to actually
# replace sys.stdout/stderr if we're in the old-style conversion mode.
new_stdout = AnsiToWin32(sys.stdout, convert=None, strip=None, autoreset=False)
if new_stdout.convert:
sys.stdout = new_stdout
new_stderr = AnsiToWin32(sys.stderr, convert=None, strip=None, autoreset=False)
if new_stderr.convert:
sys.stderr = new_stderr
fixed_windows_console = True
I'll let you debug how your system manages the remainder of the code.
sys.platform
.Cheers scott
I have tried to use this function both on interpreter and pycharm, it doesn't even appear on method menu.