krill icon indicating copy to clipboard operation
krill copied to clipboard

Curses/Blessings unsupported on windows

Open ThomasFitconnect opened this issue 9 years ago • 4 comments

Krill crashes on windows.

The root cause of the crash is that curses is not on windows machines.

The library you are using for terminal manipulation (blessings) has an open issue on github for this here.

It looks like you are only using this to color/format text in the terminal. It may be worth looking into colorama which is cross platform.

If I have time I might try and implement this myself.

Traceback:

Traceback (most recent call last):
  File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python34\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python34\Scripts\krill.exe\__main__.py", line 5, in <module>
  File "C:\Python34\lib\site-packages\krill\krill.py", line 31, in <module>
    from blessings import Terminal
  File "C:\Python34\lib\site-packages\blessings\__init__.py", line 5, in <module>

    import curses
  File "C:\Python34\lib\curses\__init__.py", line 13, in <module>
    from _curses import *
ImportError: No module named '_curses'

Other than this minor issue I really like you code :)

ThomasFitconnect avatar Aug 10 '15 09:08 ThomasFitconnect

Thank you for the input. I do not have access to a Windows machine so supporting Windows is not really on my agenda, but I hear there are proper terminal emulators for Windows too (e.g. one based on PuTTY) that have no problem with ANSI escape codes. Alternatively, Cygwin has a curses implementation that should work as well.

I don't quite understand why blessings requires curses in the first place though. What little terminal features it offers could easily be provided with raw escape sequences.

p-e-w avatar Aug 12 '15 18:08 p-e-w

Alternately, could you add a flag which would disable curses color?

brunston avatar Aug 12 '15 19:08 brunston

AFAIK (having been looking at curses/blessings/urwid/etc lately), I suspect it's that curses wraps a lot of terminal functionality behind the scenes. As in, you could successfully use krill on a terminal that actually doesn't support colors, as curses wraps something like termcap and then will display the ansi sequences or not, depending. I could be wrong, though ;)

As another alternative to colorama, I think clint supports Windows... but I don't currently have a Windows box so I could be wrong about that one, too :P

waynew avatar Oct 05 '15 21:10 waynew

It looks like the Click library handles ANSI colors automagically. With an added bonus of making CLI parsing rather nice ;)

waynew avatar Oct 17 '15 17:10 waynew