Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'attempting': 0.04; 'args': 0.05; 'subject:Python': 0.06; 'python': 0.08; 'failing': 0.09; 'state)': 0.09; 'am,': 0.12; 'subject:Issue': 0.15; '"can\'t': 0.16; "'w')": 0.16; 'brandon': 0.16; 'disk.': 0.16; 'throws': 0.16; "wouldn't": 0.16; 'written': 0.17; 'advance': 0.17; 'wrote:': 0.18; 'onto': 0.18; 'header:In- Reply-To:1': 0.23; 'fine': 0.26; "i'm": 0.26; 'function': 0.27; 'raise': 0.27; 'class': 0.29; 'fairly': 0.30; 'apologies.': 0.30; 'typeerror:': 0.30; 'error': 0.31; 'least': 0.31; 'thanks': 0.31; 'error.': 0.32; 'objects': 0.32; "can't": 0.32; 'to:addr:python- list': 0.32; "i've": 0.33; 'calling': 0.33; 'header:User-Agent:1': 0.33; "what's": 0.35; 'object': 0.35; 'file': 0.36; 'class.': 0.36; 'but': 0.37; 'issue': 0.37; 'run': 0.38; 'some': 0.38; 'initially': 0.38; "there's": 0.39; 'got': 0.39; 'subject:: ': 0.39; 'third': 0.39; 'to:addr:python.org': 0.39; 'skip:_ 10': 0.40; 'data': 0.40; 'received:209': 0.40; 'back': 0.62; 'discovered': 0.68; '--->': 0.84; '09:42': 0.84 Date: Thu, 03 Nov 2011 09:58:51 -0500 From: Brandon Harris User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.38.b3pre.fc13 Lightning/1.0b3pre Thunderbird/3.1.9 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Python Pickling Issue References: <4EB2A840.5060108@reelfx.com> In-Reply-To: <4EB2A840.5060108@reelfx.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Nov 2011 14:58:07.0863 (UTC) FILETIME=[FF479870:01CC9A38] X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1320332334 news.xs4all.nl 6918 [2001:888:2000:d::a6]:38074 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15294 After digging around a while I discovered I was attempting to pickle a third party class that can't be pickled. Initially I was removing it before pickling and everything was kosher, but at some point it got back onto the class. Apologies. Brandon L. Harris On 11/03/2011 09:42 AM, Brandon Harris wrote: > I have written a fairly large DAG with python and I've run into an > issue when attempting to pickle the data to disk. > It will pickle fine the first time, but if I call pickle again, it > throws this error. > > /usr/lib64/python2.6/copy_reg.py in _reduce_ex(self, proto) > 68 else: > 69 if base is self.__class__: > ---> 70 raise TypeError, "can't pickle %s objects" % > base.__name__ > 71 state = base(self) > 72 args = (self.__class__, base, state) > > TypeError: can't pickle function objects > > I'm calling > save_file = open('my_file.rsf', 'w') > cPickle.dump(self, save_file) > > I have attempted to pickle the object to a different file after the > first time, but the error is still thrown. > > This wouldn't be very hard to track down if the error gave any > indication as to where or what this function it can't pickle is, so > if there's any possible way to at least get the name of what's failing > to be pickled, that would be a win. > > Thanks in advance for all replies. > > Brandon L. Harris >