Skip to content

pyreadline not compatible with Python 3.10 REPL on Windows #252

Closed
@emcf

Description

@emcf

I am using python 3.10.8, and my LaTeX-OCR suddenly broke overnight, giving the following error:

Traceback (most recent call last):
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\Scripts\latexocr.exe\__main__.py", line 7, in <module>
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\site-packages\pix2tex\__main__.py", line 25, in main
    from .gui import main
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\site-packages\pix2tex\gui.py", line 17, in <module>
    from pix2tex import cli
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\site-packages\pix2tex\cli.py", line 16, in <module>
    import readline
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\site-packages\readline.py", line 34, in <module>
    rl = Readline()
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyreadline\rlmain.py", line 422, in __init__
    BaseReadline.__init__(self)
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyreadline\rlmain.py", line 62, in __init__
    mode.init_editing_mode(None)
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
    self._bind_key('space',       self.self_insert)
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
    if not callable(func):
  File "C:\Users\mcfar\AppData\Local\Programs\Python\Python310\lib\site-packages\pyreadline\py3k_compat.py", line 8, in callable
    return isinstance(x, collections.Callable)
AttributeError: module 'collections' has no attribute 'Callable'

Another issues thread (hylang/hy#2114) suggests this has to do with pyreadline not being compatible with the windows python 3.10. liyiliuxingyu says the following, which fixed this for me:

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.

Hope this helps.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions