[mod_python] "unsubscriptable object" error when instantiating a session

Graham Dumpleton grahamd at dscpl.com.au
Wed Jul 13 05:40:41 EDT 2005


Known issue, see:

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

It is because you are setting PythonHandler outside of a Directory
directive. You could have worked around the problem by setting
ApplicationPath rather than changing source code, although source
code fix has already been included for next version.

On 13/07/2005, at 5:28 PM, Roberto Aguilar wrote:

> Hello,
>
> When attempting to instantiate a session object, I get the following 
> error:
>
>   File "/berto/lib/python2.4/site-packages/mod_python/Session.py",
> line 389, in Session
>     timeout=timeout, lock=lock)
>
>   File "/berto/lib/python2.4/site-packages/mod_python/Session.py",
> line 294, in __init__
>     timeout=timeout, lock=lock)
>
>   File "/berto/lib/python2.4/site-packages/mod_python/Session.py",
> line 132, in __init__
>     Cookie.add_cookie(self._req, self.make_cookie())
>
>   File "/berto/lib/python2.4/site-packages/mod_python/Session.py",
> line 160, in make_cookie
>     c.path = dirpath[len(docroot):]
>
> TypeError: unsubscriptable object
>
> Turns out dirpath = None on the two systems I've tried this on:
>
> - linux, apache 2.0.54, python 2.2, mod_python 3.1.4
> - os x apache 2.0.54, python 2.4.1, mod_python 3.1.4
>
> I'm not sure if I did the correct thing, but, here is a patch to solve
> the issue.  Please let me know if what I did is totally off.  But, at
> least sessions are working just fine now.  : )
>
> Thanks!
>
> -berto.
> <Session.py.patch>_______________________________________________
> 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