tempfile problem on win98

Steven Adams quickdry at users.sourceforge.net
Thu Mar 22 14:25:32 CET 2001


Hi,

I'm using the tempfile module in Python 1.5.2 and it keeps giving me
duplicate filenames.

It's being called only once each time the script runs, (small cgi
messageboard) with this is the code related to the tempfile:

 import tempfile
 tempfile.tempdir=SOME_DIRECTORY
 tempfile.template=None
 id=tempfile.mktemp()

shouldn't this give me a unique value for id every time? I initially
had it running without the tempfile.template being assigned None, but
when I noticed the duplicate filenames, so I thought I'd try that.

Currently I'm making it recompute tempfile names until it has one that
does not already exist, but why does this happen?once I get a lot of
messages in the system I don't want to be possibly iterating through
the whole lot checking their names (unfortunately I don't have
permissions or the space to use a proper database)

thanks for any help,

Steven





More information about the Python-list mailing list