Dear Carlos,
haven't used mod_wsgi so far, but remember there was a patch submitted to
the list related to mod_wsgi :

> Von: Patrick J. McNerthney [mailto:pmcnerth...@ncircle.com]
> Gesendet: Freitag, 6. Juli 2012 05:40
> An: pylucene-dev@lucene.apache.org
> Betreff: Supporting mod_wsgi python sub-interpreters
> 
> I would like to propose the attached patch to support the use of python
sub-
> interpreters, which are used by mod_wsgi.  If there is interest, I can
further
> clarify.
> 
> Pat

That hasn't been discussed further, but maybe Pat can comment on what the
patch was good for or what problem it solves?

BTW, the error you encounter may not be related to the python interpreter
not finding jcc.dll but rather that jcc.dll cannot be loaded in the current
process - e.g. because of wrong path in environment. I can for example
reproduce this by setting PATH=C:\ and invoke python:

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import jcc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"c:\Devel\Python27\lib\site-packages\jcc-2.13-py2.7-win32.egg\jcc\__init__.p
y", line 31, in <module>
    from jcc import _jcc
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
>>>

A typical problem in not being able to import lucene/jcc is a missing DLL
(msvcr71.DLL) which is required by the loaded DLL. Sometimes it helps to
load the DLL directly - in a command shell (interpreter) environment for
example a windows dialogue may popup and tell you about the missing DLL.
That may not work in a server process... Hope that helps.

 
Regards,
Thomas

> -----Ursprüngliche Nachricht-----
> Von: Carlos Ferreira [mailto:to.carlos.ferre...@gmail.com]
> Gesendet: Donnerstag, 16. August 2012 04:17
> An: pylucene-dev@lucene.apache.org
> Betreff: DLL load failed: The specified module could not be found. from
jcc
> import _jcc
> 
> Hi, Please help I am unable to get Pylucene working with JCC  on Apache
> 2.22 using Mod_WSGI on Windows XP.
> 
> 
> 
> *Works from Command Line*
> 
> C:\python
> 
> Python 2.7.1 (r271:86832, Nov  27 2010 18:30:46) [MSC v.1500 32 bit
(Intel)] on
> win32
> 
> >>> import jcc
> 
> >>>from jcc import _jcc
> 
> >>>dir (_jcc)
> 
> [‘Boolean’, ‘Bye’, ‘CLASSPATH’, …..
> 
> 
> 
> Works from Command Line
> 
> C:\python
> c:\Python27\Lib\site-packages\JCC-2.13-py2.7-win32.egg\jcc\__init__.py
> 
>      JCC – C++/Python Java Native Interface Code Generator
> 
>      Usage: python –m jcc.__main__ [options] [actions]
> 
> 
> 
> *Fails with MOD_WSGI using a simple test script:*
> 
> import os, sys
> 
> sys.path.append('C:\Python27\Lib\site-packages\JCC-2.13-py2.7-
> win32.egg\jcc.dll')
> 
> sys.path.append('C:\Program Files\Java\jre6\bin\client\jvm.dll')
> 
> 
> 
> def application(environ, start_response):
> 
>     import jcc
> 
>     from jcc import _jcc
> 
> 
> 
>     status = '200 OK'
> 
>     output = ''
> 
>     output += 'sys.version = %s\n' % repr(sys.version)
> 
>     output += 'sys.prefix = %s\n' % repr(sys.prefix)
> 
>     output += 'sys.path = %s\n' % repr(sys.path)
> 
>     output += 'wsgi.multithread = %s\n' %
repr(environ['wsgi.multithread'])
> 
>     output += 'mod_wsgi.process_group = %s\n' %
> repr(environ['mod_wsgi.process_group'])
> 
>     output += 'os.environ = %s \n'    % repr(os.environ['Path'])
> 
> 
> 
>     response_headers = [('Content-type', 'text/plain'),
> 
>                         ('Content-Length', str(len(output)))]
> 
>     start_response(status, response_headers)
> 
> 
> 
>     return [output]
> 
> 
> 
> *Fails with error:*
> 
> [Wed Aug 15 18:44:19 2012] [warn] mod_wsgi: Compiled for Python/2.7.
> 
> [Wed Aug 15 18:44:19 2012] [warn] mod_wsgi: Runtime using Python/2.7.1.
> 
> [Wed Aug 15 18:44:19 2012] [notice] Apache/2.2.22 (Win32) mod_wsgi/3.3
> Python/2.7.1 configured -- resuming normal operations
> 
> [Wed Aug 15 18:44:19 2012] [notice] Server built: Jan 28 2012 11:16:39
> 
> [Wed Aug 15 18:44:19 2012] [notice] Parent: Created child process 4596
> 
> [Wed Aug 15 18:44:19 2012] [warn] mod_wsgi: Compiled for Python/2.7.
> 
> [Wed Aug 15 18:44:19 2012] [warn] mod_wsgi: Runtime using Python/2.7.1.
> 
> [Wed Aug 15 18:44:19 2012] [notice] Child 4596: Child process is running
> 
> [Wed Aug 15 18:44:19 2012] [notice] Child 4596: Acquired the start mutex.
> 
> [Wed Aug 15 18:44:19 2012] [notice] Child 4596: Starting 64 worker
threads.
> 
> [Wed Aug 15 18:44:19 2012] [notice] Child 4596: Starting thread to listen
on
> port 80.
> 
> [Wed Aug 15 18:44:30 2012] [error] [client 127.0.0.1] mod_wsgi (pid=4596):
> Exception occurred processing WSGI script 'C:/temp/wsgi_test.py'.
> 
> [Wed Aug 15 18:44:30 2012] [error] [client 127.0.0.1] Traceback (most
recent
> call last):
> 
> [Wed Aug 15 18:44:30 2012] [error] [client 127.0.0.1]   File
> "C:/temp/wsgi_test.py", line 6, in application
> 
> [Wed Aug 15 18:44:30 2012] [error] [client 127.0.0.1]     import jcc
> 
> [Wed Aug 15 18:44:30 2012] [error] [client 127.0.0.1]   File
> "c:\\Python27\\lib\\site-packages\\jcc-2.13-py2.7-
> win32.egg\\jcc\\__init__.py",
> line 31, in <module>
> 
> [Wed Aug 15 18:44:30 2012] [error] [client 127.0.0.1]     from jcc import
> _jcc
> 
> [Wed Aug 15 18:44:30 2012] [error] [client 127.0.0.1] ImportError: DLL
load
> failed: The specified module could not be found.
> 
> 
> 
> *I think Mod_WSGI is installed correctly because removing this from the
> above test script:*
> 
>     import jcc
> 
>     from jcc import _jcc
> 
> 
> 
> *Results correct output in the browser window:*
> 
> sys.version = '2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500
> 32 bit (Intel)]'
> 
> sys.prefix = 'c:\\Python27'
> 
> sys.path = ['c:\\Python27\\lib\\site-packages\\south-0.7.3-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\django_admin_tools-0.4.0-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\oauth2-1.5.170-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\httplib2-0.7.2-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\django_social_auth-0.6.0-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\python_openid-2.2.5-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\python_dateutil-1.5-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\distribute-0.6.24-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\django_chronograph-0.2.0.dev-
> py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\pyofc2-0.1.5dev-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\anyjson-0.3.1-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\django_pagination-1.0.7-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\gdata-2.0.17-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\flickrapi-1.4.2-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\threadpool-1.2.7-py2.7.egg',
> 'c:\\Python27\\lib\\site-packages\\jcc-2.13-py2.7-win32.egg',
> 'c:\\Python27\\lib\\site-packages\\lucene-3.6.0-py2.7-win32.egg',
> 'c:\\Python27\\Lib', 'c:\\test\\git_repo\\src',
> 'c:\\test\\git_repo\\src\\plunk4', 'C:\\Program
> Files\\Java\\jdk1.6.0_26\\bin', 'C:\\Program
> Files\\Java\\jdk1.6.0_26\\bin\\client', 'C:\\Program Files\\Apache
Software
> Foundation\\Apache2.2', 'C:\\WINDOWS\\system32\\python27.zip',
> 'c:\\Python27\\DLLs', 'c:\\Python27\\lib\\plat-win',
'c:\\Python27\\lib\\lib-
> tk', 'C:\\Program Files\\Apache Software Foundation\\Apache2.2\\bin',
> 'c:\\Python27', 'c:\\Python27\\lib\\site-packages',
> 'C:\\Python27\\Lib\\site-packages\\JCC-2.13-py2.7-win32.egg\\jcc.dll',
> 'C:\\Program Files\\Java\\jre6\x08in\\client\\jvm.dll',
> 'C:\\Python27\\Lib\\site-packages\\JCC-2.13-py2.7-win32.egg\\jcc.dll',
> 'C:\\Program Files\\Java\\jre6\x08in\\client\\jvm.dll']
> 
> wsgi.multithread = True
> 
> mod_wsgi.process_group = ''
> 
> os.environ = 'c:\\Python27\\lib\\site-packages\\jcc-2.13-py2.7-
> win32.egg;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\system
> 32\\wbem;c:\\program
> files\\common files\\roxio shared\\dllshared\\;c:\\program files\\common
> files\\roxio shared\\10.0\\dllshared\\;C:\\Program
> Files\\Java\\jdk1.6.0_26\\jre\\bin;C:\\Program
> Files\\Java\\jdk1.6.0_26\\jre\\bin\\client;c:\\ant\\apache-ant-
> 1.8.2\\bin;c:\\python27\\scripts;c:\\python27;c:\\program
> files\\git\\cmd;c:\\program
> files\\ibm\\gsk8\\lib;C:\\PROGRA~1\\IBM\\SQLLIB\\BIN;C:\\PROGRA~1\\IB
> M\\SQLLIB\\FUNCTION;C:\\PROGRA~1\\IBM\\SQLLIB\\SAMPLES\\REPL;C:\\
> Program
> Files\\MySQL\\MySQL Server 5.5\\bin;C:\\Program
> Files\\QuickTime\\QTSystem\\;c:\\Python27;C:\\WINDOWS\\system32\\Wi
> ndowsPowerShell\\v1.0;C:\\Python27\\Lib\\site-packages\\JCC-2.13-py2.7-
> win32.egg;'
> 
> 
> 
> I think the problem has something to do with how paths are being
> interpreted when the jcc script is run via command line versus when it is
run
> inside the MOD_WSGI process. I believe it is inserting extra \\ in the
path
> separator.  So rather than c:\\python27\\Lib paths are being interpreted
as
> c:\\\\python\\\\Lib
> 
> 
> 
> Appreciate any help on this. I have been stuck for a few days now.
> 
> 
> 
> Thanks.
> 
> Carlos
> 
> * *
> *What version of the product are you using? On what operating system?*
> 
> lucene-3.6.0-py2.7-win32.egg
> 
> JCC-2.13-py2.7-win32.egg
> 
> Python 2.7.1
> 
> Windows XP 32 bit
> Apache 2.2.2
> 
> **


Reply via email to