Exception ignored in: <function InputDevice.__del__ at 0x7f4c3c1f5430>
ForwardFeed opened this issue · 3 comments
Exception ignored in: <function InputDevice.__del__ at 0x7f4c3c1f5430>
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/evdev/device.py", line 159, in __del__
File "/usr/lib/python3/dist-packages/evdev/device.py", line 304, in close
File "/usr/lib/python3/dist-packages/evdev/eventio_async.py", line 54, in close
File "/usr/lib/python3.8/asyncio/events.py", line 722, in get_event_loop_policy
File "/usr/lib/python3.8/asyncio/events.py", line 715, in _init_event_loop_policy
ImportError: sys.meta_path is None, Python is likely shutting down
Hi, up is my error code, down is how produced it:
#!/bin/python3
import evdev
device = evdev.InputDevice('/dev/input/event3')
def foo():
print("")
Note that if i remove the foo function it works entirely and i can do all of this in a python console so it won't crash.
My Python version:
3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0]
Thanks for submitting. I can't reproduce it unfortunately. Python 3.10.5 (main, Jun 6 2022, 18:49:26) [GCC 12.1.0]
I wonder if this exception should be handled in https://github.com/gvalkov/python-evdev/blob/main/evdev/eventio_async.py#L53, just like the RuntimeError
possibly related: https://bugs.python.org/issue44221
there are various random occasions on which people see this error apparently. Also see https://stackoverflow.com/a/69193630
I don't think this should be handled in the try/except. It doesn't look like it causes any harm, seems to be rare and doesn't look like it is specifically related to python-evdev.
Thanks for the quick and detailed answer
One of my friend couldn't reproduce the error either.
I'm also accumulating a lot of random python errors on my side very recently, i guess my installation kinda got corrupted.
So i'll go for a new fresh installation of my coding environment.