Can not import PersistentMapping
When I include the following line of code: from Persistence.PersistentMapping import PersistentMapping in my Product, it causes this error when I try to import it: AttributeError: 'Persistence.PersistentMapping' module has no attribute '__basicnew__' after which I have to restart Zope from the command line, the error continues to be displayed with every request, so I can not use the management interface. This line of code, however, works fine: from Persistence.PersistentList import PersistentList Is this a bug in Zope? I can't imagine why PersistentList would work fine, but PersistentMapping will not even import. The source code is there for both, and I have tried reinstalling Zope in case it was a corrupt file or something, but no luck. I can of course just create my own object with a normal {}, and use _p_changed=1 as needed, but I wanted to share and see if anyone else had experienced this problem. Zope Version (Zope 2.6.2 (binary release, python 2.1, win32-x86), python 2.1.3, win32) Python Version 2.1.3 (#35, Apr 8 2002, 17:47:50) [MSC 32 bit (Intel)] --Sean Complete Error Message: Site Error An error was encountered while publishing this resource. exceptions.AttributeError Sorry, a site error occurred. Traceback (innermost last): Module ZPublisher.Publish, line 150, in publish_module Module ZPublisher.Publish, line 114, in publish Module Zope.App.startup, line 174, in zpublisher_exception_hook Module ZODB.ZApplication, line 61, in __bobo_traverse__ Module ZODB.Connection, line 532, in root Module ZODB.Connection, line 160, in __getitem__ __traceback_info__: ('\x00\x00\x00\x00\x00\x00\x00\x00', '((U\x0bPersistenceq\x01U\x11PersistentMappingq\x02tq\x03Nt.}q\x04U\n_contai nerq\x05}q\x06(U\n_pack_timeq\x07GA\xcb\x97\x14bV\xc2\x9cU\x0bRefreshDataq\x 08(U\x08\x00\x00\x00\x00\x00\x02jPq\t(h\x01U\x11PersistentMappingq\nttQU\x08 ZGlobalsq\x0b(U\x08\x00\x00\x00\x00\x00\x00\x00[q\x0c(U\x05BTreeq\rU\x05BTre eq\x0ettQU\x0bApplicationq\x0f(U\x08\x00\x00\x00\x00\x00\x00\x00\x02q\x10(U\ x0fOFS.Applicationq\x11U\x0bApplicationq\x12ttQus.') AttributeError: 'Persistence.PersistentMapping' module has no attribute '__basicnew__'
Sean wrote at 2004-1-23 22:07 -0500:
When I include the following line of code:
from Persistence.PersistentMapping import PersistentMapping
in my Product, it causes this error when I try to import it:
AttributeError: 'Persistence.PersistentMapping' module has no attribute '__basicnew__'
In my Zope codebase (Zope 2.7b3), "Persistence.PersistentMapping" is itself the class (and not a module). "from Persistence.PersistentMapping import PersistentMapping" gives me: "ImportError: No module named PersistentMapping". -- Dieter
Yeah, I am starting to see some differences here from version to version. I just tried to send my code over to my Linux server which is running Zope 2.6.1, and now It can't fine PersistentList (although the import error is less catastrophic) - But my dev machine which is running Zope 2.6.2 on Windows had no problem importing PersistentList (as a module - as previously stated), but failed badly with PersistentMapping. Looking at the ZOPE 2.6.2 Source on the Windows machine, I see code for modules: Persistence.PersistentMapping, and Persistence.PersistentList On Linux, the Zope 2.6.1 Source has a Persistence Directory with nothing in it. The __init__.py file says: ...While obviously there is nothing in this module, the correct names are inserted by the __init__.py in ZODB, jumpstarting the process.""" Actually, the __init__.py file on the windows machine says the same thing, but there ARE in fact source files in the directory for both the PersistentMapping and PersistentList modules - as well as some ".c" and ".h" files - as follows: cPickleCache.c cPersistence.c cPersistence.h PersistentList.py PersistentMapping.py Would these be differences between the two versions of Zope, or are the classes not properly setup on the Linux box, and once they are, I could expect to see the source files that I see on the Windows box? Or, perhaps the way these classes were being implemented was changing between the two releases, and I should just upgrade both machines to 2.6.4 which is listed as the current stable release, or 2.7.0rc1. Recommendations? --Sean
-----Original Message----- From: Dieter Maurer [mailto:dieter@handshake.de] Sent: Saturday, January 24, 2004 5:32 AM To: Sean Cc: zope@zope.org Subject: Re: [Zope] Can not import PersistentMapping
Sean wrote at 2004-1-23 22:07 -0500:
When I include the following line of code:
from Persistence.PersistentMapping import PersistentMapping
in my Product, it causes this error when I try to import it:
AttributeError: 'Persistence.PersistentMapping' module has no attribute '__basicnew__'
In my Zope codebase (Zope 2.7b3), "Persistence.PersistentMapping" is itself the class (and not a module).
"from Persistence.PersistentMapping import PersistentMapping" gives me: "ImportError: No module named PersistentMapping".
-- Dieter
Sean wrote:
Or, perhaps the way these classes were being implemented was changing between the two releases, and I should just upgrade both machines to 2.6.4 which is listed as the current stable release,
try that first... cheers, Chris
Thanks, I will do that soon. In the mean time I just wrote my own OFS.SimpleItem wrappers for [] and {} that each resolve conflicts the way I need them to. --Sean
-----Original Message----- From: Chris Withers [mailto:chris@simplistix.co.uk] Sent: Monday, January 26, 2004 4:55 AM To: Sean Cc: Dieter Maurer; zope@zope.org Subject: Re: [Zope] Can not import PersistentMapping
Sean wrote:
Or, perhaps the way these classes were being implemented was changing between the two releases, and I should just upgrade both machines to 2.6.4 which is listed as the current stable release,
try that first...
cheers,
Chris
participants (3)
-
Chris Withers -
Dieter Maurer -
Sean