Uwsgi: ImportError: No module named uwsgi

Created on 15 Oct 2015  路  8Comments  路  Source: unbit/uwsgi

Hi,
In recent versions I started getting this error when trying to import uwsgi into a python script:

ImportError: No module named uwsgi

I tested this on uWSGI 2.0.11.1 and 2.0.11.2

Here are the steps to reproduce:

pip install uwsgi
python -c 'import uwsgi'

Most helpful comment

Il 15/10/2015 23:29, Bastian Kuberek ha scritto:

According to https://uwsgi-docs.readthedocs.org/en/latest/Install.html I should
been able to run |pip install uwsgi| and import it intop my python script, but
the uwsgi lib is never installed in site-packages

Hello, in that page there's no mention of uwsgi a generally available python
module. It's exported by the uwsgi process itself through the python plugin. So
it's available in your app but not on your shell.

Riccardo Magliocchetti
@rmistaken

http://menodizero.it

All 8 comments

According to https://uwsgi-docs.readthedocs.org/en/latest/Install.html I should been able to run pip install uwsgi and import it into my python script, but the uwsgi lib is never installed in site-packages

Il 15/10/2015 23:29, Bastian Kuberek ha scritto:

According to https://uwsgi-docs.readthedocs.org/en/latest/Install.html I should
been able to run |pip install uwsgi| and import it intop my python script, but
the uwsgi lib is never installed in site-packages

Hello, in that page there's no mention of uwsgi a generally available python
module. It's exported by the uwsgi process itself through the python plugin. So
it's available in your app but not on your shell.

Riccardo Magliocchetti
@rmistaken

http://menodizero.it

Oh ok. Thanks for clarifying that.

My use case is tests: some of them don't run under the uwsgi context, but when trying to import uwsgi it fails trying to import the module.

Is there any work around to this?

I have the same question . Did you solve it ?

@mxjily - my solution eventually was to wrap the uwsgi with try/except and ensure in the tests to mock it.

Not ideal, but did the trick.

OK,Thank you

@nvgoldin - can you show the pattern how you mocked the import uwsgi in the test context? we are using uwsgi.is_connected() api on the server to verify if client holds a connection and simulate server thread timeout/termination if takes too long.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pdonadeo picture pdonadeo  路  5Comments

diwu1989 picture diwu1989  路  7Comments

Fiedzia picture Fiedzia  路  4Comments

cancan101 picture cancan101  路  4Comments

ilrico picture ilrico  路  7Comments