Hi everyone,<br><br>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.
<br><br><span style="font-family: courier new,monospace;">def savegame(fname):<br> # This part isn't necessary, I just wanted to see if it would save to the user's home folder<br style="font-family: courier new,monospace;">
</span><span style="font-family: courier new,monospace;"> if <a href="http://os.name">os.name</a> == "posix":</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
fname = "~/" + fname</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> infile = open(fname,"w")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> # Save the maps</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> mapchanges.append([6,1,rrmap])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> mapchanges.append([6,2,treemap])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> picklelist = [choins, inventory, book, mapchanges, event, cdata]
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> pickle.dump(picklelist,infile)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
# Delete the saved maps because they will just get in the way later</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> del mapchanges[len(mapchanges)-1]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> del mapchanges[len(mapchanges)-1]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> infile.close()</span><br>
<br>David Millar<br><a href="http://www.thegriddle.net/python/">http://www.thegriddle.net/python/</a><br>