Is tempfile.mkdtemp() thread-safe?

Gabriel Rossetti gabriel.rossetti at arimaz.com
Fri Aug 22 10:49:25 EDT 2008


Dennis Lee Bieber wrote:
> On Thu, 21 Aug 2008 13:22:33 +0200, Gabriel Rossetti
> <gabriel.rossetti at arimaz.com> declaimed the following in
> comp.lang.python:
>
>   
>> have a solution? I have to create unique and temp. directories to use an 
>> external program that creates a temp. file with the same name every 
>> time, thus if I want to call it from several threads, each call has to 
>> be from a different directory.
>>
>>     
> 	Have you considered passing in the ID (string-formatted) of the
> thread itself as a parameter (suffix)?
>   

Ok, it doesn't work, I think it's not thread-safe, but if someone knows 
better, I'd appreciate it.

Thanks,
Gabriel



More information about the Python-list mailing list