KeystrokeMonitor: loop parameter in Queue throws error in python 3.10
Thanks for filing an issue! Please answer the questions below so I can help you.
-
iTerm2 version: 3.4.8
-
OS version: macOS 12.0.1 (Monterey)
This is an issue with the Python API, not the iterm2 Program.
Per the exception below when running on py 3.10 and using the KeystrokeMonitor, I get
TypeError: As of 3.10, the *loop* parameter was removed from Queue() since it is no longer necessary
I see from setup.py that the API uses py 3.6. I was using it no problem with 3.9. Would you accept a pull request that used sys.version
or sys.version_info
to conditionally instantiate the queue in KeystrokeMonitor.__init__
with or without the loop
parameter depending on version? Any other artifacts you'd need I could get them to you if you think this is a good idea. If not, no worries! Thanks for iTerm2
async with iterm2.KeystrokeMonitor(connection) as mon:
File "/Users/jwheeler/Library/Caches/pypoetry/virtualenvs/xr9GXxhu-py3.10/lib/python3.10/site-packages/iterm2/keyboard.py", line 401, in __init__
self.__queue: asyncio.Queue = asyncio.Queue(
File "/Users/jwheeler/homebrew/Cellar/python@3.10/3.10.1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/queues.py", line 33, in __init__
super().__init__(loop=loop)
File "/Users/jwheeler/homebrew/Cellar/python@3.10/3.10.1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/mixins.py", line 17, in __init__
raise TypeError(
TypeError: As of 3.10, the *loop* parameter was removed from Queue() since it is no longer necessary
Edited by John W.