'PyCharm Debugger failure with Poetry despite working in Run configuration
I'm attempting to debug a Poetry script (that I didn't write) in PyCharm, but am running into problems with the Debug Configuration.
I am able to run the script without error directly from my bash shell. I used those parameters to set up my Run Configuration, which behaves as I expect. Here's the output from running without the debugger:
/Users/me/Library/Caches/pypoetry/virtualenvs/infra-KKsTCFNL-py3.9/bin/python /Users/me/Projects/infra/bin/my-script -c a_flag
Success!
So far so good; however, when I click debug, I get:
/Users/me/Library/Caches/pypoetry/virtualenvs/infra-KKsTCFNL-py3.9/bin/python /Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 49371 --file /Users/me/Projects/infra/bin/my-script -c a_flag
Connected to pydev debugger (build 212.4746.96)
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 261, in _add_reader
key = self._selector.get_key(fd)
File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 193, in get_key
raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '6 is not registered'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 523, in register
self._selector.control([kev], 0, 0)
TypeError: changelist must be an iterable of select.kevent objects
python-BaseException
Exception ignored in: <function BaseEventLoop.__del__ at 0x10e139820>
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 683, in __del__
self.close()
File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/unix_events.py", line 63, in close
if self._signal_handlers:
AttributeError: '_UnixSelectorEventLoop' object has no attribute '_signal_handlers'
sys:1: RuntimeWarning: coroutine 'main' was never awaited
Process finished with exit code 1
and here is the minimal my-script
#!/usr/bin/env python3
import asyncio
import sys
async def main():
print("Success!")
if __name__ == "__main__":
sys.exit(asyncio.run(main()))
So the error occurs before ever entering main(). I am somewhat at a loss for appropriate next steps -- is the problem Poetry? My Debug configuration? My interpreter?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
