Normand Savard
nsavard at mapgears.com
Thu Jul 2 14:47:30 EDT 2009
I'm having an issue with the ssl module when mod_python is loaded. I try to import ssl and got a "No module named _ssl" error (see below for the complete error output). I have an Apache conf file and a Python script that is presented below. When I use Python through the CGI, I'm able to import ssl with no error (see the Apache conf file and script used down below) as well as when I import the ssl module on the command line. Does someone have a hint of what maybe the problem? Thanks. Norm ------------------------------------ Python mode: ------------------------------------ Apache conf file: LoadModule python_module libexec/mod_python.so Alias /test "/home/nsavard/fgsmodpython2/www/htdocs/test" <Directory /home/nsavard/fgsmodpython2/www/htdocs/test> AddHandler python-program .py PythonHandler http-proxy PythonDebug On </Directory> The script is: import os from mod_python import apache import ssl def handler(req): req.content_type = "text/plain" req.send_http_header() req.write("Proxy Hello World!") req.write('pythonhome => %s' % os.getenv('PYTHONHOME')) req.write('pythonpath => %s' % os.getenv('PYTHONPATH')) return apache.OK The error is: MOD_PYTHON ERROR ProcessId: 30036 Interpreter: 'localhost' ServerName: 'localhost' DocumentRoot: '/home/nsavard/fgsmodpython2/www/htdocs' URI: '/test/http-proxy.py' Location: None Directory: '/home/nsavard/fgsmodpython2/www/htdocs/test/' Filename: '/home/nsavard/fgsmodpython2/www/htdocs/test/http-proxy.py' PathInfo: '' Phase: 'PythonHandler' Handler: 'http-proxy' Traceback (most recent call last): File "/home/nsavard/fgsmodpython2/lib/python2.6/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) File "/home/nsavard/fgsmodpython2/lib/python2.6/site-packages/mod_python/importer.py", line 1202, in _process_target module = import_module(module_name, path=path) File "/home/nsavard/fgsmodpython2/lib/python2.6/site-packages/mod_python/importer.py", line 296, in import_module log, import_path) File "/home/nsavard/fgsmodpython2/lib/python2.6/site-packages/mod_python/importer.py", line 680, in import_module execfile(file, module.__dict__) File "/home/nsavard/fgsmodpython2/www/htdocs/test/http-proxy.py", line 6, in <module> import ssl File "/home/nsavard/fgsmodpython2/lib/python2.6/ssl.py", line 60, in <module> import _ssl # if we can't import it, let the error propagate ImportError: No module named _ssl MODULE CACHE DETAILS Accessed: Thu Jul 2 14:31:48 2009 Generation: 0 _mp_dcbd4ef7bb04377d9cde8848becdadc4 { FileName: '/home/nsavard/fgsmodpython2/www/htdocs/test/http-proxy.py' Instance: 1 [IMPORT] Generation: 0 [ERROR] Modified: Tue Jun 30 16:12:23 2009 } ----------------------------------------------- CGI mode ---------------------------------------------- The Apache conf file: Alias /test "/home/nsavard/fgsmodpython2/www/htdocs/test" <Directory "/home/nsavard/fgsmodpython2/www/htdocs/test"> AllowOverride None Options Indexes FollowSymLinks Multiviews ExecCGI Order allow,deny Allow from all </Directory> AddHandler cgi-script .py The Python script is: #!/home/nsavard/fgsmodpython2/bin/python print "Content-type: text/html" print print "hello4" import ssl print "hello5" I
|