[mod_python] Session Causes TypeError: unscriptable object

Marvin Addison marvin.addison at sfacademy.org
Fri Feb 25 17:10:32 EST 2005


We are getting the following error when attempting to use the mod_python Session object:

  File "C:\Python23\Lib\site-packages\mod_python\apache.py", line 299, in HandlerDispatch
    result = object(req)
  File "C:\Python23\Lib\site-packages\mod_python\publisher.py", line 136, in handler
    result = util.apply_fs_data(object, req.form, req=req)
  File "C:\Python23\Lib\site-packages\mod_python\util.py", line 361, in apply_fs_data
    return object(**args)
  File "C:/Develop/Websites/intranet.sfaadmin.org/www/reports\gpa-cum.py", line 205, in print_gpa
    session = Session.Session(req)
  File "C:\Python23\lib\site-packages\mod_python\Session.py", line 386, in Session
    timeout=timeout, lock=lock)
  File "C:\Python23\lib\site-packages\mod_python\Session.py", line 358, in __init__
    timeout=timeout, lock=lock)
  File "C:\Python23\lib\site-packages\mod_python\Session.py", line 132, in __init__
    Cookie.add_cookie(self._req, self.make_cookie())
  File "C:\Python23\lib\site-packages\mod_python\Session.py", line 160, in make_cookie
    c.path = dirpath[len(docroot):]
TypeError: unsubscriptable object

This is problem appears very similar to another post, http://modpython.org/pipermail/mod_python/2004-May/015705.html.  Unfortunately, there was no response to the problem on this thread.

Some additional information that might help someone help me:
 - The codebase on which I am encountering an error worked fine on Apache 2.0.52 when run the Apache process ran as LOCALSYSTEM on W2K3.  Running it as a normal user account on Apache 2.0.53 produces this error.  Smells like a permissions problem.
 - Changing line 160 of Session.py to the following works like a charm, including performing post backs that load and modify the session data we stored previously:
c.path = '/'.
 - The real problem with line 160 in Session.py is that the value of the dirpath variable appears to be None (confirmed through testing).  The dirpath variable is set on the previous line with the statement:
dirpath = self._req.hlist.directory
Apparently, the directory property of Request.hlist is None which sets dirpath to None as well causing line 160 to fail with TypeError: unsubscriptable object.

Any help or direction on this issue is greatly appreciated.

Marvin



More information about the Mod_python mailing list