Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.05; 'error:': 0.07; 'referring': 0.07; 'string': 0.09; '-1)': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'django': 0.11; 'a(object):': 0.16; 'effect.': 0.16; 'files)': 0.16; 'means.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'sockets': 0.16; 'subject:class': 0.16; 'subject:object': 0.16; 'subject:type': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'header:User- Agent:1': 0.23; 'error': 0.23; '(such': 0.24; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; "i'm": 0.30; 'code': 0.31; '"",': 0.31; 'file': 0.32; 'class': 0.32; '(most': 0.33; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'doing': 0.36; 'hi,': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'most': 0.60; 'simple': 0.61; 'here:': 0.62; 'name': 0.63; 'object:': 0.84; 'pickled': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: UnpicklingError: NEWOBJ class argument isn't a type object Date: Mon, 08 Jul 2013 09:45:55 +0200 Organization: None References: <18dd6d34-5afa-4324-bd2f-f5561413b156@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p5084b029.dip0.t-ipconnect.de User-Agent: KNode/4.7.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373269568 news.xs4all.nl 15927 [2001:888:2000:d::a6]:56117 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50127 skunkwerk wrote: > Hi, > I'm using a custom pickler that replaces any un-pickleable objects (such > as sockets or files) with a string representation of them, based on the > code from Shane Hathaway here: > http://stackoverflow.com/questions/4080688/python-pickling-a-dict-with- some-unpicklable-items > > It works most of the time, but when I try to unpickle a Django > HttpResponse, I get the following error: UnpicklingError: NEWOBJ class > argument isn't a type object > > I have no clue what the error actually means. If it pickles okay, why > should it not be able to unpickle? Any ideas? A simple way to provoke the error is to rebind the name referring to the class of the pickled object: >>> import cPickle >>> class A(object): pass ... >>> p = cPickle.dumps(A(), -1) >>> cPickle.loads(p) <__main__.A object at 0x7fce7bb58c50> >>> A = 42 >>> cPickle.loads(p) Traceback (most recent call last): File "", line 1, in cPickle.UnpicklingError: NEWOBJ class argument isn't a type object You may be doing something to that effect.