riverbed / steelscript

SteelScript is a collection of libraries and scripts in Python for interacting with Riverbed solutions and appliances, and other network infrastructure devices
https://support.riverbed.com/apis/steelscript
Other
14 stars 10 forks source link

'steel about' fails on Windows due to missing library 'readline' #21

Open jkraenzle opened 3 years ago

jkraenzle commented 3 years ago

It seems the steel command calls into steelscript\commands\rest.py, which tries to import the library readline. That library was deprecated, and on Windows, it should use pyreadline. The setup.py seems to already install pyreadline for win32 systems. This occurred on Windows Server 2019.

D:\Download>steel about Traceback (most recent call last): File "d:\python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "d:\python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "D:\Python39\Scripts\steel.exe__main__.py", line 7, in File "d:\python39\lib\site-packages\steelscript\commands\steel.py", line 1037, in run cmd.parse(sys.argv[1:]) File "d:\python39\lib\site-packages\steelscript\commands\steel.py", line 276, in parse subcmds = [subcmd for subcmd in self.subcommands File "d:\python39\lib\site-packages\steelscript\commands\steel.py", line 367, in subcommands super(SteelCommand, self).subcommands File "d:\python39\lib\site-packages\steelscript\commands\steel.py", line 157, in subcommands self.load_subcommands() File "d:\python39\lib\site-packages\steelscript\commands\steel.py", line 253, in load_subcommands i = importlib.import_module(n) File "d:\python39\lib\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "d:\python39\lib\site-packages\steelscript\commands\rest.py", line 12, in import readline ModuleNotFoundError: No module named 'readline'

Here are the details on the changes required: https://pypi.org/project/readline/

For Windows, instead of importing readline, it needs to use pyreadline and then according to other sites, assign readline to the pyreadline class.

from pyreadline import Readline readline = Readline()

jkraenzle commented 3 years ago

It looks like it could just be modified to be: try: import readline except ImportError: from pyreadline import Readline readline = Readline()