unpickling derived LogRecord in python 2.7 from python2.6

ivdneut at gmail.com ivdneut at gmail.com
Wed Apr 27 09:56:43 EDT 2011


Hello all,

I have a service that runs in python 2.6.4. This service sends
LogRecords to a log monitoring app on my workstation running python
2.7. The LogRecord class is derived:

class LogRecord(logging.LogRecord):

    def __init__(self, name, level, fn, lno, user, hostname, msg,
args, exc_info, func=None):

        if sys.version_info[1] > 4:
            logging.LogRecord.__init__(self, name, level, fn, lno,
msg, args, exc_info, func)
        else:
            logging.LogRecord.__init__(self, name, level, fn, lno,
msg, args, exc_info)

Now when I try to unpickle it:

record = cPickle.loads(data)

I get a TypeError exception:

TypeError: ('__init__() takes at least 8 arguments (1 given)', <class
'...gRecord'>, ())

I've searched the web and this group, but most results are old. It
worked when my workstation still ran python 2.6.

Thank you,

Ian.



More information about the Python-list mailing list