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

Windows Support? #43

Closed
scruffaluff opened this issue Dec 17, 2019 · 8 comments · Fixed by #45
Closed

Windows Support? #43

scruffaluff opened this issue Dec 17, 2019 · 8 comments · Fixed by #45
Labels
help wanted Extra attention is needed

Comments

@scruffaluff
Copy link

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 error
ModuleNotFoundError: No module named _curses.
Am I suppose to use a different command to activate the git hooks on Windows?

@bjoernricks bjoernricks added the help wanted Extra attention is needed label Dec 17, 2019
@bjoernricks
Copy link
Contributor

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.

@bjoernricks
Copy link
Contributor

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

@scruffaluff
Copy link
Author

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'

@bjoernricks
Copy link
Contributor

Could you do me a favor and just run import curses in a python shell?

@scruffaluff
Copy link
Author

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'

@bjoernricks
Copy link
Contributor

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.

@bjoernricks
Copy link
Contributor

Hmm maybe blessings doesn't work at all on windows erikrose/blessings#21

@jquast
Copy link

jquast commented Feb 3, 2020

(FWIW, blessed, a fork of blessings, does work on windows)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants