Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problem with pickle

Started by silverphyre673 Mar 12, 2008 at 5:08 PM 0 replies 1.3k views
Original Post
silverphyre673
silverphyre673
Hello! I'm trying to use pickle to output a big class object to a file. It was working in an earlier version of my code (and the class being dumped hasn't changed at all), but isn't working now. I get the following error on my call to pickle.dump: Traceback (most recent call last): File "", line 1, in ? Test() File "/home/ben/Desktop/pdg.py", line 179, in Test pickle.dump(generation, p) File "pickle.py", line 1382, in dump Pickler(file, protocol, bin).dump(obj) File "pickle.py", line 210, in __init__ self.write = file.write AttributeError: PDG_Player instance has no attribute 'write' I can post more project code if it would help. Thanks very much.
my siteGenius is 1% inspiration and 99% perspiration
Hollower
Hollower
pickle.dump(generation, p)

The second argument p is supposed to be an open file object. The traceback says it is a PDG_Player instance. That doesn't sound right. I think you smehow got your arguments mixed up.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.