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

Does not work in cygwin and msys2. #6

Open
tyan0 opened this issue Jun 15, 2022 · 0 comments
Open

Does not work in cygwin and msys2. #6

tyan0 opened this issue Jun 15, 2022 · 0 comments

Comments

@tyan0
Copy link

tyan0 commented Jun 15, 2022

Describe the bug
lolpython 2.2.0 does not work in cygwin and msys2. lolpython 2.0.0 worked correctly.
The following error message is shown.

No support for colour on this terminal. Try bash/cygwin.

To Reproduce
Steps to reproduce the behavior:

  1. Insltall cygwin or msys2 with python and pip
  2. Run 'pip install lolpython' in cygwin or msys2 terminal
  3. Set environment variable TERM to 'xterm-256color' if TERM is 'xterm'
  4. Run following code in python.
from lolpython import lol_py
lol_py("AAAAAAAAAAAAAAAAAAAA")

Expected behavior
Gradate-colored 'AAAAAAAAAAAAAAAAAAAA' text should be shown.

Desktop (please complete the following information):

  • OS: Windows 10 (21H2)
  • cygwin version: 3.3.5
  • msys2 version: 3.3.5

The patch to fix the issue

diff --git a/lolpython/main.py b/lolpython/main.py
index 221606d..b872887 100644
--- a/lolpython/main.py
+++ b/lolpython/main.py
@@ -21,7 +21,7 @@ def supports_color():
     """
     plat = sys.platform
     supported_platform = (plat != 'Pocket PC' and ('ANSICON' in os.environ)) \
-                        or (plat.lower() == 'linux' and os.environ.get('TERM', '').endswith('256color'))
+                        or os.environ.get('TERM', '').endswith('256color')
     is_wnd_term = detect_windows_terminal()
     # isatty is not always implemented, #6223.
     is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant