Skip to content

Exception when running aiohttp example with PyQt5 #60

@grossmj

Description

@grossmj

First, setup a virtual env with Python 3.8, install the dependencies and edit executor_example.py to use PyQt5:

$ python3.8 -m venv test-python3.8
$ source test-python3.8/bin/activate
$ python3 -m pip install pyqt5 qasync aiohttp

Then execute the example, fetch a page and close the window:

$ python3 executor_example.py

Traceback (most recent call last):
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/tmp/test-python3.8/lib/python3.8/site-packages/qasync/__init__.py", line 409, in run_until_complete
    return future.result()
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 95, in <module>
    qasync.run(main())
  File "/tmp/test-python3.8/lib/python3.8/site-packages/qasync/__init__.py", line 821, in run
    return asyncio.run(*args, **kwargs)
  File "/usr/lib/python3.8/asyncio/runners.py", line 51, in run
    loop.close()
  File "/tmp/test-python3.8/lib/python3.8/site-packages/qasync/__init__.py", line 449, in close
    notifier.setEnabled(False)
RuntimeError: wrapped C/C++ object of type QSocketNotifier has been deleted

I was also able to reproduce with Python 3.7

Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/tmp/test-python3.7/lib/python3.7/site-packages/qasync/__init__.py", line 409, in run_until_complete
    return future.result()
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 95, in <module>
    qasync.run(main())
  File "/tmp/test-python3.7/lib/python3.7/site-packages/qasync/__init__.py", line 821, in run
    return asyncio.run(*args, **kwargs)
  File "/usr/lib/python3.7/asyncio/runners.py", line 50, in run
    loop.close()
  File "/tmp/test-python3.7/lib/python3.7/site-packages/qasync/__init__.py", line 449, in close
    notifier.setEnabled(False)
RuntimeError: wrapped C/C++ object of type QSocketNotifier has been deleted

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 96, in <module>
    except asyncio.exceptions.CancelledError:
AttributeError: module 'asyncio' has no attribute 'exceptions'

Interestingly, I got no issue with Python 3.10 or when using Pyside2/Pyside6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions