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

remove readline import from cli_demo.py #357

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pikasTech
Copy link

Remove unused readline import from cli_demo.py

Pull Request Description

In this pull request, we've removed the unused readline import from cli_demo.py.

Changes Made

Removed the import readline line from cli_demo.py.
Reason for Changes
The readline library was imported in cli_demo.py, but was never used in the script. This import sometimes caused an error on certain Windows platforms, where the readline library doesn't work as expected.

python cli_demo.py
Traceback (most recent call last):
  File "D:\AI\ChatGLM2-6B\cli_demo.py", line 5, in <module>
    import readline
  File "C:\Users\admin\.conda\envs\chatglm2\Lib\site-packages\readline.py", line 34, in <module>
    rl = Readline()
         ^^^^^^^^^^
  File "C:\Users\admin\.conda\envs\chatglm2\Lib\site-packages\pyreadline\rlmain.py", line 422, in __init__
    BaseReadline.__init__(self)
  File "C:\Users\admin\.conda\envs\chatglm2\Lib\site-packages\pyreadline\rlmain.py", line 62, in __init__
    mode.init_editing_mode(None)
  File "C:\Users\admin\.conda\envs\chatglm2\Lib\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
    self._bind_key('space',       self.self_insert)
  File "C:\Users\admin\.conda\envs\chatglm2\Lib\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
    if not callable(func):
           ^^^^^^^^^^^^^^
  File "C:\Users\admin\.conda\envs\chatglm2\Lib\site-packages\pyreadline\py3k_compat.py", line 8, in callable
    return isinstance(x, collections.Callable)
                         ^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'

Removing this unnecessary import improves the overall compatibility of the script with different platforms and reduces the possibility of encountering import errors. Users will be able to run the script without any additional requirements or modifications related to the readline library.

Testing

After removing the readline import, we ensured that the cli_demo.py script runs successfully without any import errors across different platforms. The functionality of the script remains unaffected by this change.

Please review and let us know if there are any concerns or further changes required.

Thank you!

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

Successfully merging this pull request may close these issues.

None yet

1 participant