Question on os.tempnam() vulnerability

Grant Edwards grante at
Sat Jan 5 15:40:06 CET 2008

On 2008-01-05, Jarek Zgoda <jzgoda at> wrote:

>> Under Windows, is there a "safe" way to create a temp file
>> that has a name that can be passed to a program which will
>> then open it? I never figured out a way to do that and had to
>> fall back on the "unsafe" tmpnam method.
> I think it's all impossible to get only file name and feel
> safe. You have to have both file name and a file object opened
> exclusively for you. Any other way you'll get a possible race
> condition.

I know.  That's the point of my question: how do you do that
under Windows?

Grant Edwards                   grante             Yow!  HAIR TONICS, please!!

More information about the Python-list mailing list