[mod_python] SystemError: error return without exception set

Graham Dumpleton grahamd at dscpl.com.au
Tue Jul 25 06:18:55 EDT 2006


On 25/07/2006, at 6:49 PM, Antonis Christofides wrote:

> Thank you for the replies.  I replaced sys.stderr.write with
> mod_python.apache.log_error, so that the code is correct, and I get
> identical results.  Now, "env" is set by the following code:
>
>    1    # some mod_python 2.7.X has no get method for table objects,
>    2    # so we make a real dict out of it first.
>    3    if not hasattr(req.subprocess_env,'get'):
>    4        env=dict(req.subprocess_env)
>    5    else:
>    6        env=req.subprocess_env
>    7    self._setup_vars_from_std_env(env)   <= this is the function
>                                                 where the exception
>                                                 occurs
>
> I found out that line 6 actually runs.  When I moved line 4 out of the
> "if" and commented out the rest, env.get was working properly
> afterwards.  Maybe env.get exists but does not work properly?

 From what I can tell no mod_python 2.7.X has the get() method. At least
2.7.10 doesn't and there was no 2.7.X version after that.

Instead of get() you can use [] subscript but you will have to catch the
exception if key isn't present.

Don't wait for the get() method to be added as no more work is being  
done
on mod_python 2.7.X branch. The method does exist in 3.X branch though.

Graham


More information about the Mod_python mailing list