FW: [mod_python] Import problem

Olaf Stein steino at ccri.net
Tue Jun 26 11:56:23 EDT 2007


I got it to work by using apache.import_module()

Still weird though ...





------ Forwarded Message
From: Olaf Stein <steino at ccri.net>
Date: Tue, 26 Jun 2007 10:59:23 -0400
To: <mod_python at modpython.org>
Cc: <mod_python at modpython.org>
Conversation: [mod_python] Import problem
Subject: Re: [mod_python] Import problem

Graham

Thanks for your reply but I do not think this is my problem.
I have the same code running on a production server,also using mod_python
3.3.1. I am also pretty sure that on the system where I have the error, the
previosuly installed version was 3.3.1, so nothing really changed.

Could this be related to the way I configure apache before compiling?

Thanks
Olaf


On 6/22/07 6:42 PM, "Graham Dumpleton" <graham.dumpleton at gmail.com> wrote:

> Did you upgrade to mod_python 3.3.1 from an older version at the same time?
> 
> There was one incompatible change going to mod_python 3.3.1 from older
> versions. This was where the handler directory is no longer put into
> sys.path. This doesn't cause any problems if using file based modules
> in the same directory, but does if you have a Python package in the
> same directory.
> 
> Further information can be had by reading the documentation for
> apache.import_module() in:
> 
>   http://www.modpython.org/live/current/doc-html/pyapi-apmeth.html
> 
> If that stuff in the directory is a true Python package with
> __init__.py having side affects, then only choice is to move the
> directory to outside of the document tree and then use PythonPath
> directive to specify where it is located. Other alternative is to
> treat your directory as a pseudo package as described in the
> documentation.
> 
> Anyway, read the documentation and come back if you have more
> questions or need something explained.
> 
> Graham
> 
> On 23/06/07, Olaf Stein <steino at ccri.net> wrote:
>> In the folders where cqcb.py is located there is a folder simpla, with a
>> file called mod_simpla.py
>> 
>> This same code used to work that's why this is weird
>> 
>> 
>> On 6/22/07 12:00 PM, "Jim Gallacher" <jpg at jgassociates.ca> wrote:
>> 
>>> Olaf Stein wrote:
>>>> Hi all,
>>>> 
>>>> I am running into this really weird problem:
>>>> I am on a mac, apache 2.2, mod_python 3.3.1
>>>> 
>>>> I recently upgraded the python version from 2.3.5 to 2.5.1, recompiled
>>>> apache and mod_python. This resulted in import errors in my application
>>>> (like the one shown below, replacing 2.3 with 2.5).
>>>> 
>>>> As I could not figure out what happened I uninstalled 2.5, recompiled
>>>> apache
>>>> and mod_python with 2.3.5 (basically the setup that was running nicely for
>>>> a
>>>> good while) and now I get the same error.
>>>> 
>>>> Does anyone have any advice, this is driving me nuts.
>>>> Thanks in advance
>>>> Olaf
>>>> 
>>>> 
>>>> ----------------
>>>> MOD_PYTHON ERROR
>>>> 
>>>> ProcessId:      11732
>>>> Interpreter:    'resw87031esw0h.columbuschildrens.net'
>>>> 
>>>> ServerName:     'resw87031esw0h.columbuschildrens.net'
>>>> DocumentRoot:   '/usr/local/apache/htdocs'
>>>> 
>>>> URI:            '/apps/cqcb/enter'
>>>> Location:       None
>>>> Directory:      '/usr/local/apache/htdocs/apps/'
>>>> Filename:       '/usr/local/apache/htdocs/apps/cqcb.py'
>>>> PathInfo:       '/enter'
>>>> 
>>>> Phase:          'PythonHandler'
>>>> Handler:        'mod_python.publisher'
>>>> 
>>>> Traceback (most recent call last):
>>>> 
>>>>   File
>>>> 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sit>
>>>
e
>>>> -packages/mod_python/importer.py", line 1537, in HandlerDispatch
>>>>     default=default_handler, arg=req, silent=hlist.silent)
>>>> 
>>>>   File
>>>> 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sit>
>>>
e
>>>> -packages/mod_python/importer.py", line 1229, in _process_target
>>>>     result = _execute_target(config, req, object, arg)
>>>> 
>>>>   File
>>>> 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sit>
>>>
e
>>>> -packages/mod_python/importer.py", line 1128, in _execute_target
>>>>     result = object(arg)
>>>> 
>>>>   File
>>>> 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sit>
>>>
e
>>>> -packages/mod_python/publisher.py", line 204, in handler
>>>>     module = page_cache[req]
>>>> 
>>>>   File
>>>> 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sit>
>>>
e
>>>> -packages/mod_python/importer.py", line 1059, in __getitem__
>>>>     return import_module(req.filename)
>>>> 
>>>>   File
>>>> 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sit>
>>>
e
>>>> -packages/mod_python/importer.py", line 296, in import_module
>>>>     log, import_path)
>>>> 
>>>>   File
>>>> 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sit>
>>>
e
>>>> -packages/mod_python/importer.py", line 680, in import_module
>>>>     execfile(file, module.__dict__)
>>>> 
>>>>   File "/usr/local/apache/htdocs/apps/cqcb.py", line 25, in ?
>>>>     from simpla.mod_simpla import *
>>>> 
>>>> ImportError: No module named simpla.mod_simpla
>>>> 
>>> 
>>> Where is the simpla module located? It does exist, right? ;)
>>> 
>>> Jim
>>> 
>>> 
>> 
>> 
>> 
>> 
>> 
>> -------------------------
>> Olaf Stein
>> DBA
>> Center for Quantitative and Computational Biology
>> Columbus Children's Research Institute
>> 700 Children's Drive
>> phone: 1-614-355-5685
>> cell: 1-614-843-0432
>> email: steino at ccri.net
>> 
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>> 





-------------------------
Olaf Stein
DBA
Center for Quantitative and Computational Biology
Columbus Children's Research Institute
700 Children's Drive
phone: 1-614-355-5685
cell: 1-614-843-0432
email: steino at ccri.net

_______________________________________________
Mod_python mailing list
Mod_python at modpython.org
http://mailman.modpython.org/mailman/listinfo/mod_python

------ End of Forwarded Message



More information about the Mod_python mailing list