[Zope] Help - ZODB Couldn't load state

Michael Hamilton michael@actrix.gen.nz
Sat, 22 Jan 2000 17:13:53 +1300 (NZDT)


I've managed to answer my own queries.

On Fri, 21 Jan 2000, Michael Hamilton wrote:

> Is it possible to use ZODB to access a non Zope filestore from an external
> method that is being called from Zope?  I'm getting an error when I try to
> do so?

Yes, it is possible.  One thing to consider is that ZODB with the default
FileStorage manager only seems to allow one process to have the DB open
for write access.  So it more than one process needs to write you would
have to look at Digital Creations pay-for product ZEO or perhaps roll you
own server.

Be careful to correctly set up the picked classes in
Zope/lib/python/Shared, e.g.

  Zope/lib/python/Shared/MyPackage/__init__.py
  Zope/lib/python/Shared/MyPackage/MyPersistantClass1.py
  Zope/lib/python/Shared/MyPackage/MyPersistantClass2.py

And to help testing outside of Zope, in the source that retrieves the
objects put something like:

  import sys
  sys.path.append("/blah/blah/Zope/lib/python")

If you classes arn't able to be found by Zope, you will get errors such
as these:

> In the browser window:
>      Zope has encountered an error while publishing this resource. 
> 
>      Error Type: AttributeError
>      Error Value: User
> 
> with the tail of the stack trace reading:
> 
>   File /usr/local/Python/local/lib/ServiceQuery.py, line 36, in __init__
>   File /usr/local/Python/local/lib/ObjectStore.py, line 47, in getObject
>   File /usr/local/Zope/Zope-2.1.2-src/lib/python/ZODB/Connection.py, line 396, in setstate
>   File /usr/local/Zope/Zope-2.1.2-src/lib/python/ZODB/Connection.py, line 193, in _persistent_load
>     (Info: ('\000\000\000\000\000\000\000\030', ('__main__', 'User')))
>   File /usr/local/Zope/Zope-2.1.2-src/lib/python/ZODB/Connection.py, line 153, in __getitem__
> 
> And the stderr of the server emits:
> 
> 2000-01-21T09:58:11 ERROR(200) ZODB Couldn't load state for '\000\000\000\000\000\000\000\000'
>  

---
Michael Hamilton ( http://home.clear.net.nz/pages/michael.hamilton )