sage: o = open('stuff.txt','w')

If you specify a more complete path for the output file (something like "~/stuff.txt"), then you won't have to save the file through your web browser, you can just open it directly from your filesystem in the location you specify. Does this resolve the problem?