On Wednesday 07 June 2006 19:44, you wrote:
> Richard Jennings wrote at 2006-6-7 11:53 +0200:
> >I have a Zope2.7.2/Zeo2.2.2 instance running, using the standard zope.conf
> > & zeo.conf settings (exception: port=8081) and it works fine.  I want
> > read-only access to the instance zodb to read site object properties.  In
> > a test script, I have used the apparently classic pattern, shown below:
> >
> >     addr = ('localhost', 8081)
> >        storage = ClientStorage.ClientStorage(addr)
> >        db = DB(storage)
> >        conn = db.open()
> >        root = conn.root()
> >        app = root['Application']
> >
> >This results in the exception shown below.
> >The pattern is so basic and simple, it seems difficult to make a mistake,
> > but I am! Can someone tell me what?
> > ...
> >  File "/opt/zope/lib/python/ZODB/Connection.py", line 160, in __getitem__
> >    klass=self._db._classFactory(self, module, name)
> >  File "/opt/zope/lib/python/ZODB/DB.py", line 128, in _classFactory
> >    name)
> >AttributeError: 'module' object has no attribute 'Application'
>
> Almost surely, the module is "OFS.Application".
> This module defines the class "Application". If it is not there,
> then some cyclic import prevented it from being already defined.
>
> It may help to import it before you access the storage root.
Dieter, your observation was accurate and pointed me in the right direction to 
solve the specific problem I encountered, which was my PYTHONPATH.
Note for zeo newbies reading this later:  The above code does return the root 
(Zope) application correctly, but if you have products in a zope instance, it 
seems you need to initialise them and their paths as indicated by Pascal 
Peregina in this thread.

Thanks for your help, Dieter.
Richard

Many thanks,
Richard
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to