[ZODB-Dev] open/close pb

Tim Peters tim at zope.com
Fri Apr 23 12:00:18 EDT 2004


[Vincent Rioux]
> sorry for a probably very naive question,

All questions are welcome!

> I am facing some problems with ZODB3-3.3a2.win32-py2.3.exe

That's obsolete, as of a week ago.  Please try 3.3a3 instead, from

    http://www.zope.org/Products/ZODB3.3


> First (not a problem really) I always get this message:
> -------------------------------------------------------------
>   There are two possibilities:
>
>   1. You don't care about ExtensionClass. You are importing
>      Persistence because that's what you imported in the past.
>      In this case, you should really use the persistent package
>      instead:
>
>         >>> from persistent import Persistent
>         >>> from persistent.list import PersistentList
>         >>> from persistent.mapping import PersistentMapping
>
>   2. You want your classes to be ExtensionClasses. In this case,
>      you need to install the ExtensionClass package
>      separately. ExtensionClass is no-longer included with ZODB3.
>
>
> warn("""Couldn't import the ExtensionClass-based base class

This message comes from trying to import Persistence.  More info can be
found in the "What's new in ZODB3 3.3 alpha 2" section of the NEWS file:

    http://zope.org/Products/ZODB3.3/NEWS.html


> -------------------------------------------------------------
> even, If I explicitely changed my code to only import:
> from ZODB.FileStorage import FileStorage
> from ZODB import DB
> from persistent import Persistent

Sorry, I don't see this:

C:\Python23>python
Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from ZODB.FileStorage import FileStorage
>>> from ZODB import DB
>>> from persistent import Persistent
>>> # no warning message

It's often essential to show exact, complete code, like I did there.  Just
to be sure:

>>> import ZODB
>>> ZODB.__version__
'3.3a3'
>>>

It's possible that you have a PYTHONPATH problem, and aren't actually
getting the version of ZODB you think you're getting.

> Secondly, I find myself in trouble when I :
> - open a database file
> - close it
> - open an other database file
> - try to save it => i get
> "No handlers could be found for logger "txn.3244"
> and I get a ValueError.

Without the actual code, we have to try to guess what you did.  Here was my
guess, but it doesn't show any problems:

>>> from ZODB.FileStorage import FileStorage
>>> from ZODB import DB
>>> st = FileStorage('Data.fs')  # open one storage
>>> db = DB(st)                  # fiddle with it
>>> conn = db.open()
>>> conn.root()['a'] = 1
>>> get_transaction().commit()
>>> db.close()                   # close the db
>>> st = FileStorage('DataData.fs')  # open another storage
>>> db = DB(st)                      # fiddle with it
>>> conn = db.open()
>>> conn.root()['b'] = 2
>>> get_transaction().commit()
>>> db.close()                       # close the db
>>> conn.close()                     # maybe he meant the connection?
>>> st.close()                       # maybe he meant the storage?
>>> ^Z                               # give up
C:\Python23>


> Finally the only workaround I found is to quit/reopen my program each
> time I want to change of database file
>
> may be I am not precise enough...

Good guess <wink>.

> but any help would be greatly appreciated

Help us, by showing exactly what you're doing, in as small a test case as
you can make that reproduces your problem.

Note that 3.3a3 is still an alpha release, and there are certain to be bugs
remaining in it.  We just don't know what they are <wink>.




More information about the ZODB-Dev mailing list