<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>



Hey, folks, me again!<BR> <BR>I've been puzzling over this for a while now:<BR> <BR>I'm trying to write data to a file to save the state of my game using the following function:<BR> <BR>def save_game():<br>    #open a new empty shelve (possibly overwriting an old one) to write the game data<br>    file_object = open('savegame.sav', 'wb')<br>    file['map'] = map<br>    file['objects'] = objects<br>    file['player_index'] = objects.index(player)  #index of player in objects list<br>    file['inventory'] = inventory<br>    file['game_msgs'] = game_msgs<br>    file['game_state'] = game_state<br>    file['stairs_index'] = objects.index(stairs)<br>    file['dungeon_level'] = dungeon_level<br>    file.close()<BR> <BR>However, while 'savegame.sav' is created in the directory I specify, the function dies on file['map'] = map.  This is the end of the stack trace:<BR> <BR><br>  File "C:\Python Project\Roguelike.py", line 966, in save_game<br>    file['map'] = map<br>TypeError: 'type' object does not support item assignment<BR> <BR>Now, the map is randomly generated -- could that be an issue?<BR> <BR>Should I just scrap the current system and use pickle?<BR>                                      </div></body>
</html>