[mod_python] No module named _apache from inside apache

John Raines raine001 at tc.umn.edu
Mon Sep 20 20:43:56 EDT 2004


Thanks. Didn't  work for me though:
[Mon Sep 20 19:39:51 2004] [notice] mod_python: Creating 32 session 
mutexes based on 6 max processes and 25 max threads.
[Mon Sep 20 19:39:51 2004] [notice] Apache/2.0.50 (Unix) 
mod_python/3.1.3 Python/2.3.3 configured -- resuming normal operations
Traceback (most recent call last):
   File "HRAStart.py", line 5, in ?
     from mod_python import mp_helper
   File "/sw/lib/python2.3/site-packages/mod_python/mp_helper.py", line 
1, in ?
     import _apache
ImportError: No module named _apache
[Mon Sep 20 19:40:44 2004] [error] [client 127.0.0.1] Premature end of 
script headers: HRAStart.py, referer: http://127.0.0.1/
On Sep 20, 2004, at 1:45 PM, mod_python user wrote:

> John Raines wrote:
>> Subject:
>> [mod_python] No module named _apache from inside apache
>> I continue to get this error message...
> <snip />
>> ImportError: No module named _apache
>
> Hi John,
>
> I have a solution, but I can't tell you exactly why it works, only that
> it does.  There is probably a different and better way to do it.
>
> I'm pretty new to python and by extension, mod_python, but I 
> encountered
> your situation once before. I was trying to use "_apache.parse_qs" and
> "_apache.parse_qsl".
>
> The _apache module appears to be built-in to mod_python; furthermore, 
> it
> seems to be directly available *only* to other modules in the 
> mod_python
> directory.  So, in the mod_python directory I created a file,
> "mp_helper.py", whose contents consist of only one line: "import
> _apache".  Then, within my own application I include this line: "from
> mod_python import mp_helper".
>
> After that I was able to access parse_qs and parse_qsl as
> mp_helper.parse_qs and mp_helper.parse_qsl.
>
> Hope that is useful to you,
> Mike Wright
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1974 bytes
Desc: not available
Url : http://modpython.org/pipermail/mod_python/attachments/20040920/61d0d685/attachment.bin


More information about the Mod_python mailing list