[mod_python] Problems with ZODB / modpython

Graham Dumpleton grahamd at dscpl.com.au
Wed Jan 17 15:53:00 EST 2007


Thiago Comicio wrote ..
> Hi,
> 
> I'm trying to install a program that needs mod_python and ZODB. The
> program is not running, so I tried to connect to the database through
> this script:
> 
> from ZODB import FileStorage, DB
> 
> def index(req, **params):
>         storage = FileStorage.FileStorage('mydatabase.fs')
>         db = DB(storage)
>         connection = db.open()
>         root = connection.root()
>         return TestPage().getHTML()
> 
> And I received the error below.
> Does anybody know how to fix it?

A couple of things to be aware of.

1. The Apache web server generally runs as a special user and thus that user
must have write access to the directory where you are wanting to create the
database.

2. The current working directory is normally '/' for the Apache processes and
thus if you do not specify an absolute path to where you want to store the
database, it will try and store it in '/' where you are unlikely to have permissions
to write. You should not change the working directory as if every handler did
that they would all interfere with each other.

Graham
 
> Thanks
> 
> Thiago
> 
> ---------------------------
> 
> 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 213, in handler
>     published = publish_object(req, object)
> 
>   File "/usr/lib/python2.4/site-packages/mod_python/publisher.py",
> line 412, in publish_object
>     return publish_object(req,util.apply_fs_data(object, req.form, req=req))
> 
>   File "/usr/lib/python2.4/site-packages/mod_python/util.py", line
> 439, in apply_fs_data
>     return object(**args)
> 
>   File "/var/www/html/indico/teste.py", line 4, in index
>     storage = FileStorage.FileStorage('mydatabase.fs')
> 
>   File "/usr/lib/zope/lib/python/ZODB/FileStorage/FileStorage.py",
> line 112, in __init__
>     self._lock_file = LockFile(file_name + '.lock')
> 
>   File "/usr/lib/zope/lib/python/ZODB/lock_file.py", line 60, in __init__
>     self._fp = open(path, 'w+')
> 
> IOError: [Errno 13] Permission denied: 'mydatabase.fs.lock'
> _______________________________________________
> 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