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

odrivetool errors with ipython 8.11 #732

Open
therealchalz opened this issue Mar 19, 2023 · 1 comment
Open

odrivetool errors with ipython 8.11 #732

therealchalz opened this issue Mar 19, 2023 · 1 comment
Labels

Comments

@therealchalz
Copy link

Describe the bug
The odrivetool shell doesn't work with ipython 8.11. You get all sorts of various exceptions if you hit enter, tab, type anything etc.
Some examples:

Unhandled exception in event loop:
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 698, in read_from_input
    self.key_processor.process_keys()
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 272, in process_keys
    self._process_coroutine.send(key_press)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 187, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 322, in _call_handler
    handler.call(event)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 126, in call
    result = self.handler(event)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/IPython/terminal/shortcuts/__init__.py", line 374, in handle_return_or_newline_or_execute
    return newline_or_execute_outer(shell)(event)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/IPython/terminal/shortcuts/__init__.py", line 397, in newline_or_execute
    status, indent = shell.check_complete(check_text)

Exception 'NoneType' object has no attribute 'check_complete'
Unhandled exception in event loop:
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 698, in read_from_input
    self.key_processor.process_keys()
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 272, in process_keys
    self._process_coroutine.send(key_press)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 170, in _process
    matches = self._get_matches(buffer)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 128, in _get_matches
    return [b for b in self._bindings.get_bindings_for_keys(keys) if b.filter()]
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 128, in <listcomp>
    return [b for b in self._bindings.get_bindings_for_keys(keys) if b.filter()]
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/filters/base.py", line 134, in __call__
    return all(f() for f in self.filters)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/filters/base.py", line 134, in <genexpr>
    return all(f() for f in self.filters)
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/filters/base.py", line 248, in __call__
    return self.func()
  File "/home/che/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/IPython/terminal/shortcuts/filters.py", line 75, in auto_match
    return shell.auto_match

Exception 'NoneType' object has no attribute 'auto_match'
Unhandled exception in event loop:
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 698, in read_from_input
    self.key_processor.process_keys()
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 272, in process_keys
    self._process_coroutine.send(key_press)
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 170, in _process
    matches = self._get_matches(buffer)
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 128, in _get_matches
    return [b for b in self._bindings.get_bindings_for_keys(keys) if b.filter()]
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/key_binding/key_processor.py", line 128, in <listcomp>
    return [b for b in self._bindings.get_bindings_for_keys(keys) if b.filter()]
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/filters/base.py", line 134, in __call__
    return all(f() for f in self.filters)
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/filters/base.py", line 134, in <genexpr>
    return all(f() for f in self.filters)
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/filters/base.py", line 248, in __call__
    return self.func()
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/IPython/terminal/shortcuts/filters.py", line 64, in ebivim
    return shell.emacs_bindings_in_vi_insert_mode

Exception 'NoneType' object has no attribute 'emacs_bindings_in_vi_insert_mode'
Unhandled exception in event loop:
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 985, in in_term
    await _do_wait_for_enter("Press ENTER to continue...")
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 1451, in _do_wait_for_enter
    await session.app.run_async()
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 875, in run_async
    return await _run_async(f)
  File "/root/.cache/pypoetry/virtualenvs/odrive-play-Jdveoc2Y-py3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 740, in _run_async
    result = await f

Exception 
Press ENTER to continue...

To Reproduce
Use odrivetool with ipython 8.11. I had set up a poetry virtual environment with the following in the pyproject.toml file:

[tool.poetry.dependencies]
python = "^3.10"
odrive = "^0.6.5"
matplotlib = "^3.7.1"

Expected behavior
You should be able to use odrivetool like a command interpreter and issue commands like the ones in the getting started guide

Desktop

  • OS: Ubuntu 22.04.2 LTS
  • odrivetool Version: ODrive control utility v0.6.5
  • ipython 8.11

Additional context & workaround
It was a bit confusing for me at first as this was my first foray into using odrivetool and playing with an odrive, but eventually I came across this bug: ipython/ipython#13966
It's not clear to me if there should be a change made to the odrivetool code or if it's a upstream regression that should/will get fixed, but since I'm just interested in playing with the motor I simply added ipython = "8.10.0" to my virtual environment dependencies and rebuilt it, and then odrivetool was happy and I am also happy with a spinning motor. Hopefully this helps someone else.

@samuelsadok
Copy link
Member

This is a regression in IPython 8.11 but we can work around it from our end. I just pushed a corresponding hotfix release.

pip install odrive --upgrade

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

No branches or pull requests

2 participants