Re: os.tmpfile() vs. tempfile.TemporaryFile()

2010-11-12 Thread Carl Banks
On Nov 11, 10:32 am, John Nagle wrote: >    Is there any reason to prefer "tempfile.TemporaryFile()" > over "os.tmpfile()"?  Both create a nameless temporary file > that will be deleted on close. os.tmpfile calls your OS's tmpfile system call. tempfile.Tempor

Re: os.tmpfile() vs. tempfile.TemporaryFile()

2010-11-11 Thread danmcle...@yahoo.com
On Nov 11, 11:32 am, John Nagle wrote: >    Is there any reason to prefer "tempfile.TemporaryFile()" > over "os.tmpfile()"?  Both create a nameless temporary file > that will be deleted on close. > >                                 John Nagle tempfile.Tempor

os.tmpfile() vs. tempfile.TemporaryFile()

2010-11-11 Thread John Nagle
Is there any reason to prefer "tempfile.TemporaryFile()" over "os.tmpfile()"? Both create a nameless temporary file that will be deleted on close. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: os.tmpfile()

2008-01-02 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > Erik, I am going to be displaying sections of text in the Terminal Window on > OS X. > I wanted to format the text in a specific way and thought it might be quicker > to > output all the text to a temporary file that I could quickly read sections > from instead >

RE: os.tmpfile()

2008-01-02 Thread jyoung79
if this is the most efficient way to do this or not but thought at least it'd be a good way to learn something new in Python. I was assuming tmpfile() would automatically create some sort of temporary file that would automatically delete itself when the code was finished. -- > Try thi

Re: os.tmpfile()

2008-01-02 Thread Christian Heimes
[EMAIL PROTECTED] wrote: > Can anyone elaborate on how 'os.tmpfile()' works? I was thinking it would > create some sort of temporary file I could quickly add text too and then when > I was finished would automatically get rid of it. Here's my questions: Please don'

Re: os.tmpfile()

2008-01-01 Thread redawgts
Try this: >>> import os >>> c = os.tmpfile() >>> c.write('dude') >>> c.seek(0) >>> c.read() 'dude' -- http://mail.python.org/mailman/listinfo/python-list

Re: os.tmpfile()

2008-01-01 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > Can anyone elaborate on how 'os.tmpfile()' works? I was thinking it would > create some sort of temporary file I could quickly add text too and then when > I was finished would automatically get rid of it. Here's my questions: ... &

os.tmpfile()

2008-01-01 Thread jyoung79
Can anyone elaborate on how 'os.tmpfile()' works? I was thinking it would create some sort of temporary file I could quickly add text too and then when I was finished would automatically get rid of it. Here's my questions: 1. Does it actually create a file somewhere? If so

Re: os.tmpfile() -> permission denied (Win XP)

2007-02-10 Thread John Machin
On Feb 11, 4:33 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > On Feb 11, 4:15 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > En Sun, 11 Feb 2007 01:57:52 -0300, John Machin <[EMAIL PROTECTED]> > > escribió: > > > > | &g

Re: os.tmpfile() -> permission denied (Win XP)

2007-02-10 Thread John Machin
On Feb 11, 4:15 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 11 Feb 2007 01:57:52 -0300, John Machin <[EMAIL PROTECTED]> > escribió: > > > | >>> os.tmpfile() > > Traceback (most recent call last): > > File "", l

Re: os.tmpfile() -> permission denied (Win XP)

2007-02-10 Thread Gabriel Genellina
En Sun, 11 Feb 2007 01:57:52 -0300, John Machin <[EMAIL PROTECTED]> escribió: > | >>> os.tmpfile() > Traceback (most recent call last): > File "", line 1, in > OSError: [Errno 13] Permission denied > > 1. Before I start checking what permissions wh

os.tmpfile() -> permission denied (Win XP)

2007-02-10 Thread John Machin
Hi, Here's what's happening: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. | >>> import os | >>> os.tmpfile() Tracebac

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

2006-06-08 Thread Nick Craig-Wood
". I would like to switch 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? You can't. The file opened doesn't have a name tmpfile(...) tmpfile() -> file obj

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 t

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

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

2006-06-08 Thread Maric Michaud
ss.PIPE, stdout=file(tmp,"w") >         ) >         stdout,stderr = gnuplot.communicate(""" >             set terminal tkcanvas interact >             set output "%s" >             """ % tmp + commands) assuming tmp is a os.tmpfile and y

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

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 an

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 safe