Closed scruffaluff closed 4 years ago
Internally autohooks uses blessings to provide colorization of the console output. After looking at it I don't think it supports Windows :-/
Personally I am not able to write any code for Windows because my knowledge about it is very small. And I also don't have access to any Windows system.
But this doesn't mean autohooks shouldn't get support for Windows. I am only relying on PRs from external contributors.
As far as I know curses should be at least importable at windows. Could you paste the whole taceback? Maybe it is already possible to support windows by using https://github.com/tartley/colorama
FYI, I am using powershell
on Windows with poetry
and pyenv
. I haven’t tried colorama, but here is the trace back:
Windows: poetry run autohooks activate
Traceback (most recent call last):
File "C:\Users\user\.pyenv\pyenv-win\versions\3.8.0-amd64\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\user\.pyenv\pyenv-win\versions\3.8.0-amd64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\user\tmp\ahook\.venv\Scripts\autohooks.exe\__main__.py", line 5, in <module>
File "c:\users\user\tmp\ahook\.venv\lib\site-packages\autohooks\cli\__init__.py", line 20, in <module>
from autohooks.terminal import Terminal
File "c:\users\user\tmp\ahook\.venv\lib\site-packages\autohooks\terminal.py", line 17, in <module>
import curses
File "C:\Users\user\.pyenv\pyenv-win\versions\3.8.0-amd64\lib\curses\__init__.py", line 13, in <module>
from _curses import *
ModuleNotFoundError: No module named '_curses'
Could you do me a favor and just run import curses
in a python shell?
Sure. Here is the trace back:
Windows: python -i
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\.pyenv\pyenv-win\versions\3.8.0-amd64\lib\curses\__init__.py", line 13, in <module>
from _curses import *
ModuleNotFoundError: No module named '_curses'
ok. I've done some research. Python in windows doesn't support curses. It seems you need to install an additional library to get it working https://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
From https://docs.python.org/3/howto/curses.html#curses-howto
The Windows version of Python doesn’t include the curses module. A ported version called UniCurses is available. You could also try the Console module written by Fredrik Lundh, which doesn’t use the same API as curses but provides cursor-addressable text output and full support for mouse and keyboard input.
Hmm maybe blessings doesn't work at all on windows https://github.com/erikrose/blessings/issues/21
(FWIW, blessed, a fork of blessings, does work on windows)
autohooks/terminal.py depends on the curses package, which I believe is not supported on Windows. When I run the command
poetry run autohooks activate
, I receive the errorModuleNotFoundError: No module named _curses
. Am I suppose to use a different command to activate the git hooks on Windows?