i have simple bottlepy application has route starts new process using subprocess.popen. works great using command:
mod_wsgi-express start-server app.wsgi
put, when trying apache configuration, i'm getting strange exception, maybe related pymongo.
file "/usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/mongoengine/__init__.py", line 3, in <module> import fields file "/usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/mongoengine/fields.py", line 6, in <module> import urllib2 file "/usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/urllib2.py", line 94, in <module> import httplib file "/usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/httplib.py", line 80, in <module> import mimetools file "/usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/mimetools.py", line 6, in <module> import tempfile file "/usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/tempfile.py", line 32, in <module> import io _io file "/usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/io.py", line 51, in <module> import _io importerror: dlopen(/usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): symbol not found: __pycodecinfo_getincrementaldecoder referenced from: /usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/lib-dynload/_io.so expected in: flat namespace in /usr/local/opt/python/frameworks/python.framework/versions/2.7/lib/python2.7/lib-dynload/_io.so
my configuration is:
httpd.conf:
wsgipythonpath "/usr/local/lib/python2.7/site-packages"
httpd.vhosts.conf:
<virtualhost *:80> servername relferreira.com wsgidaemonprocess relferreira user=relferreira group=staff processes=1 threads=5 wsgiscriptalias "/" "/users/relferreira/documents/app.wsgi" wsgiprocessgroup relferreira <directory "/users/relferreira/documents/"> wsgiprocessgroup relferreira wsgiapplicationgroup %{global} require granted </directory> errorlog /users/relferreira/documents/api/error-bottle.log customlog /users/relferreira/documents/api/access-bottle.log combined </virtualhost>
route (simplified): can see, needed pass path sub-process, in order able load modules
@route('/extract') def extract(): try: script_path = ..... command = ..... env = os.environ.copy() env['pythonpath'] = ":".join(sys.path) proc = subprocess.popen(['python', script_path] + command, env=env) except systemexit e: abort(400, 'wrong parameters') return 'success'
otool -l:
command: otool -l /usr/local/lib/python2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so
return:
/usr/local/lib/python2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so: /usr/local/opt/python/frameworks/python.framework/versions/2.7/python (compatibility version 2.7.0, current version 2.7.0) /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 1226.10.1)
i installed python using homebrew
. know should using virtualenv, put legacy project so, i'm trying make work without it.
Comments
Post a Comment