For some reason, I can create temp files but I cannot write to them. Nothing is saved, and the file is always empty. What am I doing wrong? I've tried making it in /tmp, Ive specified mode=w+b, they all do the same. (nothing)
import tempfile
def main():
test = tempfile.NamedTemporaryFile()
test.write('asdfsadfsadfsadfasdfasdfsadfsdfsadfsadfs')
res=open(test.name,"r")
print res.read()
print test.name
return
if __name__ == '__main__':
main()