Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28476

Re: Why derivated exception can not be pickled ?

Newsgroups comp.lang.python
Date 2012-09-05 03:18 -0700
References <7bb72fb5-5ab5-4748-acbf-c8e7666ee834@googlegroups.com>
Message-ID <daed0eb8-6100-4d05-b5b1-4d8ea56ac731@googlegroups.com> (permalink)
Subject Re: Why derivated exception can not be pickled ?
From Mathieu Courtois <mathieu.courtois@gmail.com>

Show all headers | View raw


Hello,

The simple example works fine using __reduce__:

class MyError(Exception):
    def __init__(self, arg):
        self.arg = arg

    def __reduce__(self):
        return (MyError, (self.arg, ))

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Why derivated exception can not be pickled ? Mathieu Courtois <mathieu.courtois@gmail.com> - 2012-09-04 08:57 -0700
  Re: Why derivated exception can not be pickled ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-05 00:34 +0000
  Re: Why derivated exception can not be pickled ? Dieter Maurer <dieter@handshake.de> - 2012-09-05 08:02 +0200
    Re: Why derivated exception can not be pickled ? Mathieu Courtois <mathieu.courtois@gmail.com> - 2012-09-05 01:54 -0700
    Re: Why derivated exception can not be pickled ? Mathieu Courtois <mathieu.courtois@gmail.com> - 2012-09-05 01:54 -0700
  Re: Why derivated exception can not be pickled ? Mathieu Courtois <mathieu.courtois@gmail.com> - 2012-09-05 03:18 -0700

csiph-web