tempfile problem on win98

Emile van Sebille emile at fenx.com
Thu Mar 22 08:54:55 EST 2001


The mktemp routine guarantees to return a name unique in the target
directory.  Are you sure you're using fully qualified path names throughout
when subsequently discovering duplicate files?

Emile van Sebille
emile at fenx.com

"Steven Adams" <quickdry at users.sourceforge.net> wrote in message
news:g3nu6.369$hb.2141 at news1.belrs1.nsw.optushome.com.au...
> 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