Hi everyone,
I'm working on making a Debian package for a game I'm working on, and it
works fine, but I've run into a problem with my script now. The script is
placed in /usr/bin so all users on the system have access, but even though
it will run fine, I can't save files to that directory, so the saving
feature doesn't work and the rest of my game is crippled now. Any ideas on
how I could progress? I tried appending "~/" to the filename for that copy
of the script, but it just makes the terminal window close without warning.
Any help would be appreciated.
def savegame(fname):
# This part isn't necessary, I just wanted to see if it would save to
the user's home folder
if os.name == "posix":
fname = "~/" + fname
infile = open(fname,"w")
# Save the maps
mapchanges.append([6,1,rrmap])
mapchanges.append([6,2,treemap])
picklelist = [choins, inventory, book, mapchanges, event, cdata]
pickle.dump(picklelist,infile)
# Delete the saved maps because they will just get in the way later
del mapchanges[len(mapchanges)-1]
del mapchanges[len(mapchanges)-1]
infile.close()
David Millar
http://www.thegriddle.net/python/
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor