Using revised tempfile module

Peter Hansen peter at engcorp.com
Mon Jan 5 15:19:42 EST 2004


"John J. Lee" wrote:
> 
> "Edward C. Jones" <edcjones at erols.com> writes:
> 
> > #! /usr/bin/env python
> >
> > import os, tempfile
> >
> > # I have written code like this several times. It uses the deprecated
> > # function tempfile.mktemp. How do I write this with the new tempfile
> > # functions?
> 
> You read the tempfile.mkstemp documentation.

Or even just re-read the tempfile.mktemp documentation again, which says

Deprecated since release 2.3. Use mkstemp() instead.
  Warning: Use of this function may introduce a security hole in your program. 
  By the time you get around to doing anything with the file name it returns, 
  someone else may have beaten you to the punch. 

-Peter



More information about the Python-list mailing list