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

Python 3.10 on Windows fails: AttributeError: module 'collections' has no attribute 'Callable' #2114

Closed
tianon opened this issue Jul 12, 2021 · 8 comments · Fixed by #2115
Closed
Labels

Comments

@tianon
Copy link
Member

tianon commented Jul 12, 2021

Thanks to pyreadline/pyreadline#65, Hy on Python 3.10 on Windows no longer starts, and a backtrace similar to the following is the result:

Traceback (most recent call last):
  File "c:\python\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Python\Scripts\hy.exe\__main__.py", line 4, in <module>
  File "c:\python\lib\site-packages\hy\cmdline.py", line 37, in <module>
    from hy.completer import completion, Completer
  File "c:\python\lib\site-packages\hy\completer.py", line 18, in <module>
    import readline
  File "c:\python\lib\site-packages\readline.py", line 34, in <module>
    rl = Readline()
  File "c:\python\lib\site-packages\pyreadline\rlmain.py", line 422, in __init__
    BaseReadline.__init__(self)
  File "c:\python\lib\site-packages\pyreadline\rlmain.py", line 62, in __init__
    mode.init_editing_mode(None)
  File "c:\python\lib\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
    self._bind_key('space',       self.self_insert)
  File "c:\python\lib\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
    if not callable(func):
  File "c:\python\lib\site-packages\pyreadline\py3k_compat.py", line 8, in callable
    return isinstance(x, collections.Callable)
AttributeError: module 'collections' has no attribute 'Callable'

Unfortunately from that bug (and the repository in general), it would appear that pyreadline is no longer actively maintained (last update of any kind was in 2015), so for Hy to continue to support Windows on future Python versions will require some amount of workaround (a fork of pyreadline, dropping readline support on Windows, etc).

I'm not sure if there's a way to specify that Python 3.10+ and Windows are simply mutually incompatible, but that would be the "simplest" workaround if there's a clean way to specify that. 🙈

tianon added a commit to hylang/docker-hylang that referenced this issue Jul 12, 2021
@Kodiologist
Copy link
Member

I'm not sure if there's a way to specify that Python 3.10+ and Windows are simply mutually incompatible

We don't really officially support operating systems other than Linux, because we only test on Linux (#2025 (comment)).

@Kodiologist
Copy link
Member

If you want to fix this, the easiest way is just to not use Readline in the REPL on Windows.

@liyiliuxingyu
Copy link

Please change the code in line 8 of "c:\python\lib\site-packages\pyreadline\py3k_compat.py" to return isinstance(x, collections.abc.Callable), so that it can run successfully.

@Kodiologist
Copy link
Member

This is the repository for Hy, not pyreadline.

@qq463505965
Copy link

Please change the code in line 8 of "c:\python\lib\site-packages\pyreadline\py3k_compat.py" to return isinstance(x, collections.abc.Callable), so that it can run successfully.

great

@liyiliuxingyu
Copy link

This is the repository for Hy, not pyreadline.

事实证明,我是对的
In fact, I'm right.
Because @tianon question is pyreadline's bug for Windows.

@AnshumanFauzdar
Copy link

Please change the code in line 8 of "c:\python\lib\site-packages\pyreadline\py3k_compat.py" to return isinstance(x, collections.abc.Callable), so that it can run successfully.

Will it be maintained or just a temporary fix?
Curious to know what fixes the problem?
Thanks in advance :)

@Kodiologist
Copy link
Member

Kodiologist commented Dec 30, 2021

I'm gonna say this only one more time: this is the repository for Hy, not pyreadline. Even if you Googled something about pyreadline and ended up on this page, we don't maintain that library. We can't fix it.

The pyreadline issue you're looking for is pyreadline/pyreadline#65.

@hylang hylang locked as off-topic and limited conversation to collaborators Dec 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants