RE: Writing game-state data...

2012-11-09 Thread Prasad, Ramit
Graham Fielding wrote: > > Hey, folks, me again! > > I've been puzzling over this for a while now: > > I'm trying to write data to a file to save the state of my game using the > following function: > > def save_game(): >     #open a new empty shelve (possibly overwriting an old one) to write

RE: Writing game-state data...

2012-11-09 Thread Graham Fielding
> To: python-list@python.org > From: breamore...@yahoo.co.uk > Subject: Re: Writing game-state data... > Date: Fri, 9 Nov 2012 07:37:56 + > > On 09/11/2012 07:20, Graham Fielding wrote: > > > > Hey, folks, me again! I've been puzzling over this for a

Re: Writing game-state data...

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 12:20 AM, Graham Fielding wrote: > file_object = open('savegame.sav', 'wb') Here you open a file and assign it to "file_object". > file['map'] = map Here you attempt to write to "file" instead of "file_object". "file" is the name of a built-in type, hence your e

Re: Writing game-state data...

2012-11-08 Thread Mark Lawrence
On 09/11/2012 07:20, Graham Fielding wrote: Hey, folks, me again! I've been puzzling over this for a while now: I'm trying to write data to a file to save the state of my game using the following function: def save_game(): #open a new empty shelve (possibly overwriting an old one) to writ