[Fixed]-OpenCV imread hanging when called from a web request

9๐Ÿ‘

I had a similar issue and found a fix -> just add to your apache configuration:

WSGIScriptAlias application-group=%{GLOBAL}

Apparently it happens when you have an extension module not designed to work in sub interpreter. The above forces it to run in main interpreter.

Sources:
django apache mod-wsgi hangs on importing a python module from .so file
http://blog.rtwilson.com/how-to-fix-flask-wsgi-webapp-hanging-when-importing-a-module-such-as-numpy-or-matplotlib/

๐Ÿ‘คHugo Flick

3๐Ÿ‘

Wrong

imagePath = os.path.dirname(__file__) + "/1.jpg"

Right

from os.path import abspath, join, dirname

imagePath = abspath( join(dirname(__file__), "1.jpg") )
๐Ÿ‘คb1_

0๐Ÿ‘

Just wanted to add to this thread.

My /etc/apache2/sites-available/default-ssl.conf needed a little more than just the WSGIScriptAlias application-group=%{GLOBAL}.

I had to add it to the end of my existing definition of the variable

WSGIScriptAlias / /home/me/my_project/my_project/wsgi.py application-group=%{GLOBAL}
๐Ÿ‘คScrimpy

Leave a comment