#python #linux #nginx #flask #uwsgi
Вопрос:
Я запускаю колбу с uwsgi, во время работы я получаю ошибку ниже
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 0.0.0.0:7443 fd 8
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.9.1 (default, Jan 21 2021, 17:26:44) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/export/apps/python/3.9.1/lib/python3.9/os.py", line 46, in _get_exports_list
return list(module.__all__)
AttributeError: module 'posix' has no attribute '__all__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/export/apps/python/3.9.1/lib/python3.9/site.py", line 73, in <module>
import os
File "/export/apps/python/3.9.1/lib/python3.9/os.py", line 69, in <module>
__all__.extend(_get_exports_list(posix))
File "/export/apps/python/3.9.1/lib/python3.9/os.py", line 48, in _get_exports_list
return [n for n in dir(module) if n[0] != '_']
SystemError: <built-in function dir> returned NULL without setting an error
конфигурационный файл
[uwsgi]
module = wsgi:app
master = true
processes = 5
protocol = http
socket = 0.0.0.0:7443
die-on-term = true
enable-threads = true
vacuum = true
req-logger = file:/var/log/uwsgi/app/cart-req.log
logger = file:/var/log/uwsgi/app/cart-err.log
Отсутствует какой-либо модуль, то же самое работает в python 3.7, но не в 3.9
Ответ №1:
uwsgi
пока не поддерживает Python 3.9.
Смотрите, например, классификаторы сокровищ в https://github.com/unbit/uwsgi/blob/master/setup.py
Вы должны создать проблему в их системе отслеживания проблем https://github.com/unbit/uwsgi/issues
Обновить
Как «root-11», упомянутый в комментарии, uwsgi
тем временем поддерживает Python 3.9. Кроме того, моя ссылка сверху ссылается на «master», а не на текущую версию с момента создания этого ответа. Это может сбить с толку.
Комментарии:
1. Python3.9 теперь поддерживается: github.com/unbit/uwsgi/blob/…