aiopyramid icon indicating copy to clipboard operation
aiopyramid copied to clipboard

using aiopyramid with python 3.11

Open sxpert opened this issue 1 year ago • 0 comments

the @asyncio.coroutine decorator appears to be removed from python 3.11, and is replaced with the

async def blah ()

syntax

also "yield from" is replaced by "await"

I'm getting this sort of complaints:

[2023-03-08 16:51:11 +0100] [87369] [INFO] Starting gunicorn 20.1.0
[2023-03-08 16:51:11 +0100] [87369] [INFO] Listening at: http://127.0.0.1:8000 (87369)
[2023-03-08 16:51:11 +0100] [87369] [INFO] Using worker: sync
[2023-03-08 16:51:11 +0100] [87370] [INFO] Booting worker with pid: 87370
[2023-03-08 16:51:11 +0100] [87370] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
                ^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
                    ^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 56, in load
    return self.load_pasteapp()
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_pasteapp
    return get_wsgi_app(self.app_uri, defaults=self.cfg.paste_global_conf)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/gunicorn/app/pasterapp.py", line 19, in get_wsgi_app
    return loadapp(
           ^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/paste/deploy/loadwsgi.py", line 248, in loadapp
    return loadobj(APP, uri, name=name, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/paste/deploy/loadwsgi.py", line 273, in loadobj
    return context.create()
           ^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/paste/deploy/loadwsgi.py", line 741, in create
    return self.object_type.invoke(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/paste/deploy/loadwsgi.py", line 138, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/paste/deploy/util.py", line 61, in fix_call
    val = callable(*args, **kw)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/sismalp/__init__.py", line 14, in main
    config = Configurator(settings=settings)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/pyramid/config/__init__.py", line 303, in __init__
    self.setup_registry(
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/pyramid/config/__init__.py", line 444, in setup_registry
    self.include(inc)
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/pyramid/config/__init__.py", line 632, in include
    c = self.maybe_dotted(callable)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/pyramid/config/__init__.py", line 740, in maybe_dotted
    return self.name_resolver.maybe_resolve(dotted)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/pyramid/path.py", line 327, in maybe_resolve
    return self._resolve(dotted, package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/pyramid/path.py", line 334, in _resolve
    return self._zope_dottedname_style(dotted, package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/pyramid/path.py", line 383, in _zope_dottedname_style
    found = __import__(used)
            ^^^^^^^^^^^^^^^^
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/aiopyramid/__init__.py", line 5, in <module>
    from .config import CoroutineOrExecutorMapper
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/aiopyramid/config.py", line 9, in <module>
    from .helpers import synchronize, is_generator
  File "/Users/sxpert/Work/Projets_Dev/site_sismalp/.venv/lib/python3.11/site-packages/aiopyramid/helpers.py", line 38, in <module>
    @asyncio.coroutine
     ^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'
[2023-03-08 16:51:11 +0100] [87370] [INFO] Worker exiting (pid: 87370)
[2023-03-08 16:51:11 +0100] [87369] [INFO] Shutting down: Master
[2023-03-08 16:51:11 +0100] [87369] [INFO] Reason: Worker failed to boot.```

sxpert avatar Mar 08 '23 16:03 sxpert