[mod_python] Help! Error importing psp

Graham Dumpleton grahamd at dscpl.com.au
Sun Jun 12 19:35:53 EDT 2005


Here is the response I posted to your same question on comp.lang.python
a couple of days ago. Not sure if you saw it there.


May be related to this bug:

  http://issues.apache.org/jira/ browse/MODPYTHON-12

Where you have:

  import mod_python.psp

change it to:

  psp = apache.import_module("mod_pyth on.psp")

Access the PSP object then as:

  psp.PSP

and not:

  mod_python.psp.PSP

It will happen where somewhere else within the same document tree
there is a PythonHandler specified as mod_python.psp as well as
the explicit import of mod_python.psp. Depending on which ones gets
triggered first, it will screw up.


Graham


On 12/06/2005, at 4:07 AM, Adriano Monteiro wrote:

> Sure!!
>
> My apache configuration:
>
>     <Directory /var/www/quiron>
>         AddHandler mod_python .psp .py
>         DirectoryIndex Index.psp
>         PythonHandler mod_python.psp | .psp
>         PythonHandler mod_python.publisher | .py
>         PythonDebug On
>     </Directory>
>
> Apache 2.0.53 and mod_python 3.1.3
>
> I've created a python script to handle control flow and psp file to
> handle the vision.
> Within the pytho script I create a psp.PSP instance and call the run
> method of the object.
>
>> From time to time, I got error on psp import.
>
> I just can't understand why...
>
> My import line:
> from mod_python import psp
>
> How I call it:
>
> obj = psp.PSP (req, 'file.psp')
> obj.run ({'var':1})
>
> Something that I'm doing wrong?
>
> Regards,
>
>
> On 6/11/05, Clark <foo.Clark at gmail.com> wrote:
>> Maybe you'd better show your python script and mod_python 
>> configuration
>> (or give a simple example) to help us understand your problem.
>>
>> On Sat, Jun 11, 2005 at 02:08:37PM -0300, Adriano Monteiro wrote:
>>> Hi folks!
>>>
>>> I'm getting this error from time to time:
>>>
>>> Mod_python error: "PythonHandler mod_python.publisher"
>>>
>>> Traceback (most recent call last):
>>>
>>>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
>>> 299, in HandlerDispatch
>>>     result = object(req)
>>>
>>>   File "/usr/lib/python2.4/site-packages/mod_python/publisher.py",
>>> line 98, in handler
>>>     path=[path])
>>>
>>>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
>>> 457, in import_module
>>>     module = imp.load_module(mname, f, p, d)
>>>
>>>   File "/var/www/quiron/core/CadastrarUsuario.py", line 17, in ?
>>>     from mod_python import apache, psp
>>>
>>> ImportError: cannot import name psp
>>>
>>> I don't undesrtand why is this happening. I saw some threads that 
>>> have
>>> already talked about this problem, but I didn't find any solution!
>>> I'm almost quiting. I'll have to change the language of my project
>>> because of this problem if it persist..
>>>
>>> []'s!
>>>
>>> --
>>>
>>> Adriano Monteiro Marques
>>> www.gopython.com.br
>>> py.adriano at gmail.com
>>>
>>> I'm FREE... Are you?
>>> (PYTHON powered)
>>>
>>> _______________________________________________
>>> Mod_python mailing list
>>> Mod_python at modpython.org
>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>
>
>
> -- 
>
> Adriano Monteiro Marques
> www.gopython.com.br
> py.adriano at gmail.com
>
> I'm FREE... Are you?
> (PYTHON powered)
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python




More information about the Mod_python mailing list