Hi,
Pedro Ferreira wrote:
I've also tried to run the "analyze.py" script, but it returns me a
stream of '''type' object is unsubscriptable" errors, due to:
classinfo = pickle.loads(record.data)[0]
any suggestion?
I personally apply the attached patch to analyze.py, that does not load
pickled data in get_type() to prevent 'unsubscriptable' errors. It is
also much faster.
Regards,
--
Kazuhiko Shiozaki, Nexedi SA Senior Consultant
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org
--- analyze.py 2009-05-02 21:57:30.000000000 +0200
+++ analyze.py 2009-05-20 14:01:11.000000000 +0200
@@ -7,6 +7,7 @@
import sys
import types
from ZODB.FileStorage import FileStorage
+from ZODB.utils import get_pickle_metadata
class Report:
def __init__(self):
@@ -86,21 +87,8 @@
analyze_rec(report, rec)
def get_type(record):
- try:
- classinfo = pickle.loads(record.data)[0]
- except SystemError, err:
- s = str(err)
- mo = re.match('Failed to import class (\S+) from module (\S+)', s)
- if mo is None:
- raise
- else:
- klass, mod = mo.group(1, 2)
- return "%s.%s" % (mod, klass)
- if isinstance(classinfo, types.TupleType):
- mod, klass = classinfo
- return "%s.%s" % (mod, klass)
- else:
- return str(classinfo)
+ mod, klass = get_pickle_metadata(record.data)
+ return "%s.%s" % (mod, klass)
def analyze_rec(report, record):
oid = record.oid
_______________________________________________
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