Writing game-state data...
Ian Kelly
ian.g.kelly at gmail.com
Fri Nov 9 03:13:45 EST 2012
On Fri, Nov 9, 2012 at 12:20 AM, Graham Fielding <frednotbob at hotmail.ca> 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 error message.
Since you seem to be trying to use shelve, you should also probably be
calling shelve.open to open the file, not just open.
> file['objects'] = objects
> file['player_index'] = objects.index(player) #index of player in
> objects list
> file['inventory'] = inventory
> file['game_msgs'] = game_msgs
> file['game_state'] = game_state
> file['stairs_index'] = objects.index(stairs)
> file['dungeon_level'] = dungeon_level
> file.close()
Same issue for all these other statements.
More information about the Python-list
mailing list