Re: how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Nick Craig-Wood
Harold Fellermann <[EMAIL PROTECTED]> wrote: > I need to create a temporary file and I need to retrieve the path > of that file. os.tmpnam() would do the job quite well if it wasn't > for the RuntimeWarning "tmpnam is a potential security risk to your > program". I would like to switch to os.t

Re: how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Harold Fellermann
Chris Lambacher wrote: > You should be able to find exactly what you need in the tempfile module. > http://docs.python.org/lib/module-tempfile.html thanks! tempfile.NamedTemporaryFile() is exaclty what I have been looking for. Using python for such a long time now, and still there are unknown goo

Re: how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Steve Holden
Harold Fellermann wrote: > Maric Michaud wrote: > >>Le Jeudi 08 Juin 2006 15:30, Harold Fellermann a écrit : >> >>>to os.tmpfile() which is supposed to be safer, but I do not know how to >>>get >>>the path information from the file object returned by tmpfile(). any >>>clues? >> >>There is no path

Re: how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Chris Lambacher
You should be able to find exactly what you need in the tempfile module. http://docs.python.org/lib/module-tempfile.html os.tmpfile() is no good whether you want the filename or not since on Windows it is likely to break if you are not a privileged user. Its a windows problem, not an actual bug i

Re: how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Maric Michaud
Well, I never used gnuplot and I didn't use Tkinter for a while, but : Le Jeudi 08 Juin 2006 16:44, Harold Fellermann a écrit : >         tmp = os.tmpnam() >         gnuplot = subprocess.Popen( >             "gnuplot", shell=True, >             stdin=subprocess.PIPE, stdout=file(tmp,"w") >        

Re: how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Harold Fellermann
Maric Michaud wrote: > Le Jeudi 08 Juin 2006 15:30, Harold Fellermann a écrit : > > to os.tmpfile() which is supposed to be safer, but I do not know how to > > get > > the path information from the file object returned by tmpfile(). any > > clues? > There is no path for tmpfile, once it's closed,

Re: how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Maric Michaud
Le Jeudi 08 Juin 2006 15:30, Harold Fellermann a écrit : > to os.tmpfile() which is supposed to be safer, but I do not know how to > get > the path information from the file object returned by tmpfile(). any > clues? There is no path for tmpfile, once it's closed, the file and its content are lost

how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Harold Fellermann
Hi, I need to create a temporary file and I need to retrieve the path of that file. os.tmpnam() would do the job quite well if it wasn't for the RuntimeWarning "tmpnam is a potential security risk to your program". I would like to switch to os.tmpfile() which is supposed to be safer, but I do not