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

rshell not working #180

Open
pem120 opened this issue Mar 17, 2022 · 9 comments
Open

rshell not working #180

pem120 opened this issue Mar 17, 2022 · 9 comments

Comments

@pem120
Copy link

pem120 commented Mar 17, 2022

Traceback (most recent call last):
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\rshell-script.py", line 33, in
sys.exit(load_entry_point('rshell==0.0.29', 'console_scripts', 'rshell')())
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\rshell-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\importlib\metadata_init_.py", line 162, in load
module = import_module(match.group('module'))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\command_line.py", line 1, in
import rshell.main
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\main.py", line 80, in
import readline
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\readline.py", line 34, in
rl = Readline()
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\rlmain.py", line 422, in init
BaseReadline.init(self)
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\rlmain.py", line 62, in init
mode.init_editing_mode(None)
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
self._bind_key('space', self.self_insert)
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
if not callable(func):
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\py3k_compat.py", line 8, in callable
return isinstance(x, collections.Callable)
AttributeError: module 'collections' has no attribute 'Callable'

@evgenii-d
Copy link

Same error here. Any clues?

rshell -h

Traceback (most recent call last):
File "C:\portable\Python\Python310\Scripts\rshell-script.py", line 33, in
sys.exit(load_entry_point('rshell==0.0.31', 'console_scripts', 'rshell')())
File "C:\portable\Python\Python310\Scripts\rshell-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\portable\Python\Python310\lib\importlib\metadata_init_.py", line 162, in load
module = import_module(match.group('module'))
File "C:\portable\Python\Python310\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\portable\Python\Python310\lib\site-packages\rshell\command_line.py", line 1, in
import rshell.main
File "C:\portable\Python\Python310\lib\site-packages\rshell\main.py", line 80, in
import readline
File "C:\portable\Python\Python310\lib\site-packages\readline.py", line 34, in
rl = Readline()
File "C:\portable\Python\Python310\lib\site-packages\pyreadline\rlmain.py", line 422, in init
BaseReadline.init(self)
File "C:\portable\Python\Python310\lib\site-packages\pyreadline\rlmain.py", line 62, in init
mode.init_editing_mode(None)
File "C:\portable\Python\Python310\lib\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
self._bind_key('space', self.self_insert)
File "C:\portable\Python\Python310\lib\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
if not callable(func):
File "C:\portable\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'

@pem120
Copy link
Author

pem120 commented Mar 26, 2022

no.
Traceback (most recent call last):
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\rshell-script.py", line 33, in
sys.exit(load_entry_point('rshell==0.0.29', 'console_scripts', 'rshell')())
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\rshell-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1008.0_x64__qbz5n2kfra8p0\lib\importlib\metadata_init_.py", line 171, in load
module = import_module(match.group('module'))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1008.0_x64__qbz5n2kfra8p0\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\command_line.py", line 1, in
import rshell.main
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\main.py", line 80, in
import readline
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\readline.py", line 34, in
rl = Readline()
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\rlmain.py", line 422, in init
BaseReadline.init(self)
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\rlmain.py", line 62, in init
mode.init_editing_mode(None)
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
self._bind_key('space', self.self_insert)
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
if not callable(func):
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\py3k_compat.py", line 8, in callable
return isinstance(x, collections.Callable)
AttributeError: module 'collections' has no attribute 'Callable'

@pem120
Copy link
Author

pem120 commented Mar 26, 2022

Traceback (most recent call last):
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\rshell-script.py", line 33, in
sys.exit(load_entry_point('rshell==0.0.29', 'console_scripts', 'rshell')())
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\rshell-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1008.0_x64__qbz5n2kfra8p0\lib\importlib\metadata_init_.py", line 171, in load
module = import_module(match.group('module'))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1008.0_x64__qbz5n2kfra8p0\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\command_line.py", line 1, in
import rshell.main
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\main.py", line 80, in
import readline
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\readline.py", line 34, in
rl = Readline()
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\rlmain.py", line 422, in init
BaseReadline.init(self)
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\rlmain.py", line 62, in init
mode.init_editing_mode(None)
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
self._bind_key('space', self.self_insert)
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
if not callable(func):
File "C:\Users\IshantKuchibhatla\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\py3k_compat.py", line 8, in callable
return isinstance(x, collections.Callable)
AttributeError: module 'collections' has no attribute 'Callable'

no

@dhylands
Copy link
Owner

dhylands commented Apr 9, 2022

I think that this is a problem with Windows a readline.

Does this workaround work: #38 (comment)

@nznobody
Copy link

nznobody commented Jun 3, 2022

Possibly look a using an updated fork of pyreadline: git+https://github.com/osrf/pyreadline
As done here: ros2/ci#519
Otherwise switch to https://github.com/pyreadline3/pyreadline3

@evgenii-d
Copy link

Possibly look a using an updated fork of pyreadline: git+https://github.com/osrf/pyreadline As done here: ros2/ci#519 Otherwise switch to https://github.com/pyreadline3/pyreadline3

Installing pyreadline3 resolve the issue. Thank you.

@Techmokid
Copy link

Techmokid commented Jul 21, 2023

I've discovered the solution. "Callables" in python 3.10 or above has been moved from "collections.Callables" to "collections.abc.Callables"

The following code in the designated file "site-packages/pyreadline/py3k_compat.py" solved the issue for me, although newer versions of pyreadline3 may have already fixed this issue:

return isinstance(x, collections.Callable)

Change to:

if (sys.version_info[1] >= 10):
return isinstance(x, collections.abc.Callable)
else:
return isinstance(x, collections.Callable)

@aminhusni
Copy link

When I install pip install pyreadline3, I get this error:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\rshell.exe\__main__.py", line 4, in <module>
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\command_line.py", line 1, in <module>
    import rshell.main
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\main.py", line 80, in <module>
    import readline
ModuleNotFoundError: No module named 'readline'

When I install pip install pyreadline, I get this error:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\rshell.exe\__main__.py", line 4, in <module>
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\command_line.py", line 1, in <module>
    import rshell.main
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\rshell\main.py", line 80, in <module>
    import readline
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\readline.py", line 34, in <module>
    rl = Readline()
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\rlmain.py", line 422, in __init__
    BaseReadline.__init__(self)
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\rlmain.py", line 62, in __init__
    mode.init_editing_mode(None)
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
    self._bind_key('space',       self.self_insert)
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
    if not callable(func):
  File "C:\Users\alice\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyreadline\py3k_compat.py", line 8, in callable
    return isinstance(x, collections.Callable)
AttributeError: module 'collections' has no attribute 'Callable'

Currently there is no way to run this with the pyreadline3 workaround.

@pmansouri-davey
Copy link

@aminhusni

From: https://stackoverflow.com/a/74037892

The issue is caused by the outdated package pyreadline present as a package importable by the Python installation. As this provides the readline module for Windows version of Python, the default site module will be able to import it and trigger the error. This outdated and no longer maintained package tries to import collections.abc.Callable from the deprecated location collections.Callable, it will fail under Python 3.10 as that deprecated import has been fully removed.

In your case, the reason you are seeing the error ModuleNotFoundError: No module named 'readline' is most likely due to having install pyreadline3 when pyreadline was already installed.
Try uninstalling both and then reinstall 3:
pip uninstall pyreadline pyreadline3
pip install pyreadline3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants