[mod_python] Problems with ZODB / modpython

Graham Dumpleton grahamd at dscpl.com.au
Thu Jan 18 15:58:32 EST 2007


What version of mod_python are you using, is it an older version? At
least upgrade to mod_python 3.2.10 if you haven't already. There are
certainly bugs in mod_python 3.1.X which may cause this. Also, what
Apache configuration do you use for enabling mod_python for that
part of the URL namespace? Do you use PythonPath or PythonImport
directives?

Graham

Thiago Comicio wrote ..
> On 1/17/07, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
> > 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 Graham, this solved my initial problem, now I have another.
> 
> I created a simple script to run when I boot my system.
> 
> #main part of the script
> PYTHONPATH=/usr/lib/zope/lib/python
> 
> zope=$PYTHONPATH/ZEO/runzeo.py
> python=/usr/bin/python
> zopeconf=$PYTHONPATH/ZEO/zeo.config
> 
> start() {
>         echo -n $"Starting $prog1: "
>         $python $zope -C $zopeconf &
> }
> 
> I put a symbolic link at /etc/rc5.d with the name S50myscript and a
> symbolink link to http like S85http.
> When I try to access a page that needs ZEO I receive the error below,
> that disappears when I restart apache.
> How can I fix this new problem?
> 
> 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 204, in handler
>     module = page_cache[req]
> 
>   File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line
> 82, in __getitem__
>     return self._checkitem(name)[2]
> 
>   File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line
> 124, in _checkitem
>     value = self.build(key, name, opened, entry)
> 
>   File "/usr/lib/python2.4/site-packages/mod_python/publisher.py",
> line 77, in build
>     return ModuleCache.build(self, key, req, opened, entry)
> 
>   File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line
> 371, in build
>     exec opened in module.__dict__
> 
>   File "/var/www/html/indico/index.py", line 1, in ?
>     import MaKaC.webinterface.rh.welcome as welcome
> 
>   File "/usr/lib/python2.4/site-packages/MaKaC/webinterface/rh/welcome.py",
> line 1, in ?
>     import MaKaC.webinterface.rh.base as base
> 
>   File "/usr/lib/python2.4/site-packages/MaKaC/webinterface/rh/base.py",
> line 13, in ?
>     from ZODB.POSException import ConflictError
> 
> ImportError: No module named ZODB.POSException
> _______________________________________________
> 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