Open twillis opened 4 years ago
running pserve instead of gunicorn picks up the right worker and port from the config but then there's an import error
tom@tom-ThinkPad-P1:~/projects/tstaiopyramid/tststarter$ pipenv run pserve development.ini
Starting server in PID 31751.
Error: class uri 'aiopyramid.gunicorn.worker.AsyncGunicornWorker' invalid or not found:
[Traceback (most recent call last):
File "/home/tom/projects/tstaiopyramid/.venv/lib/python3.7/site-packages/gunicorn/util.py", line 99, in load_class
mod = importlib.import_module('.'.join(components))
File "/home/tom/projects/tstaiopyramid/.venv/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/tom/projects/tstaiopyramid/.venv/lib/python3.7/site-packages/aiopyramid/gunicorn/worker.py", line 3, in <module>
from aiohttp_wsgi.wsgi import WSGIHandler, ReadBuffer
ImportError: cannot import name 'ReadBuffer' from 'aiohttp_wsgi.wsgi' (/home/tom/projects/tstaiopyramid/.venv/lib/python3.7/site-packages/aiohttp_wsgi/wsgi.py)
]
Exiting 1 (-v to see traceback)
tom@tom-ThinkPad-P1:~/projects/tstaiopyramid/tststarter$
and checking the source code, ReadBuffer hasn't been in the wsgi module since 0.8.0 (march of 2018)
https://github.com/etianen/aiohttp-wsgi/compare/0.5.2...0.8.0
So what's going on here? is this still maintained? I know there's been a bit of churn in the past in regards to asyncio and probably aiohttp. But I just want to get websoockets working in pyramid.
Seems like gunicorn now essentially requires you to use pserve if you are going to use paste. https://docs.gunicorn.org/en/stable/run.html#paste-deployment. It will no longer respect the server definition from the paste config unless invoked with pserve:
but Gunicorn will not use any server configuration defined in the file
I was not able to replicate your import error, pserve worked for me. Have you tried configuring gunicorn separately?
The changes in gunicorn invalidate the getting started section of the docs as well as aiostarter
.
@housleyjk Hi Jason
Im dealing with the same error : class uri 'aiopyramid.gunicorn.worker.AsyncGunicornWorker' invalid or not found: Caused by: ImportError: cannot import name 'ReadBuffer' from 'aiohttp_wsgi.wsgi' (/home/xxxxx/xxxxxx/venv/lib/python3.7/site-packages/aiohttp_wsgi/wsgi.py)
Tried both with python 3.11 & 3.7 same issue.
After checking aiohttp-wsgi repo 'ReadBuffer' class seems to be missing, causing error when gunicorn start with:
worker_class = aiopyramid.gunicorn.worker.AsyncGunicornWorker
If used without worker class it works fine.
Last commit contained related class was : https://github.com/etianen/aiohttp-wsgi/commit/dd984417eacce2a52329db0440ce95ef294608d7
Any idea how to fix that ?
it seems like it's not picking up the settings in the development.ini but I dont know why that would be.