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


Groups > comp.lang.python > #28469

Re: Why derivated exception can not be pickled ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feed.xsnews.nl!border-2.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <mathieu.courtois@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'method.': 0.05; 'defines': 0.07; 'override': 0.07; 'subject:Why': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; ';-)': 0.11; 'subject:not': 0.11; 'right:': 0.16; 'subject:exception': 0.16; 'wrote:': 0.17; 'wednesday,': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'skip:" 20': 0.26; 'interface': 0.27; 'methods.': 0.29; 'pickle': 0.29; 'trigger': 0.29; 'manual': 0.29; 'skip:_ 10': 0.29; 'subject: ?': 0.30; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'there': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'several': 0.39; 'your': 0.60; 'more': 0.63; 'reply': 0.66; 'carefully': 0.71
Newsgroups comp.lang.python
Date Wed, 5 Sep 2012 01:54:21 -0700 (PDT)
In-Reply-To <mailman.211.1346824947.27098.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=31.35.138.175; posting-account=qQa_BAoAAAB6AF_SqtOQYran4yaGpqxv
References <7bb72fb5-5ab5-4748-acbf-c8e7666ee834@googlegroups.com> <mailman.211.1346824947.27098.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 31.35.138.175
MIME-Version 1.0
Subject Re: Why derivated exception can not be pickled ?
From Mathieu Courtois <mathieu.courtois@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.224.1346835264.27098.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346835264 news.xs4all.nl 6963 [2001:888:2000:d::a6]:54581
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28469

Show key headers only | View raw


Thanks for your reply


On Wednesday, September 5, 2012 8:02:55 AM UTC+2, Dieter Maurer wrote:
> 
> The pickle interface is actually more complex and there are several
> 
> ways an object can ensure picklability. For example, there is
> 
> also a "__reduce__" method. I suppose, that "Exception" defines methods
> 
> which trigger the use of an alternative picklability approach (different
> 
> from "__getstate__/__setstate__").

You're right: Exception has __reduce__ & __reduce_ex__ methods. Always read carefully the manual ;-)

I must override these methods.


MC

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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