Vidya
Vidya

Reputation: 657

python 3.9 AttributeError: module 'posix' has no attribute '__all__'

I am running flask with uwsgi, while I am running, I am getting below error

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

config file

[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

Any module is missing, same thing is working in python 3.7 but not in 3.9

Upvotes: 2

Views: 1591

Answers (1)

J&#252;rgen Gmach
J&#252;rgen Gmach

Reputation: 6123

uwsgi does not support Python 3.9 yet.

See eg the trove classifiers in https://github.com/unbit/uwsgi/blob/master/setup.py

You should create an issue at their issue tracker https://github.com/unbit/uwsgi/issues

Update

As "root-11" mentioned in the comment, uwsgi meanwhile supports Python 3.9. Also, my link from above links to "master", instead of to the current version from when this answer was created. This might be confusing.

Upvotes: 1

Related Questions