Gabriel Genellina wrote:
> As someone already suggested, why don't you use TemporaryFile or
> NamedTemporaryFile and avoid such problems?
Because I don't want file to be removed after closing.
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
> In message <[EMAIL PROTECTED]>, Michael
> J. Fromberger wrote:
>
> > ... since os.fdopen() only has access to the file descriptor, it
> > does not have a convenient way to obtain the file's name.
>
> You can do this under Linux as follows:
>
>
In message <[EMAIL PROTECTED]>, Michael
J. Fromberger wrote:
> ... since os.fdopen() only has access to the file descriptor, it
> does not have a convenient way to obtain the file's name.
You can do this under Linux as follows:
os.readlink("/proc/%d/fd/%d" % (os.getpid(), fileno))
--
http:
On Aug 28, 7:55 pm, billiejoex <[EMAIL PROTECTED]> wrote:
> Hi there.
> I'm trying to generate a brand new file with a unique name by using
> tempfile.mkstemp().
> In conjunction I used os.fdopen() to get a wrapper around file
> properties (write & read methods, and so on...) but 'name' attribute
>
On 28 ago, 22:21, billiejoex <[EMAIL PROTECTED]> wrote:
> Another question: I have to open file for writing ('wb') but I noticed
> that both tempfile.mkstemp() and os.fdopen() accept a "mode" argument.
> It's not clear *when* do I have to specify
Thanks all.
Another question: I have to open file for writing ('wb') but I noticed
that both tempfile.mkstemp() and os.fdopen() accept a "mode" argument.
It's not clear *when* do I have to specify such mode. When using
tempfile.mkstemp?
>>> fileno, name = t
billiejoex <[EMAIL PROTECTED]> wrote:
> I'm trying to generate a brand new file with a unique name by using
> tempfile.mkstemp().
>
> Moreover, I'd like to know if I'm doing fine. Does this approach avoid
> race conditions
This is a reasonably secure way of doing things. It can't race under
In article <[EMAIL PROTECTED]>,
billiejoex <[EMAIL PROTECTED]> wrote:
> Hi there.
> I'm trying to generate a brand new file with a unique name by using
> tempfile.mkstemp().
> In conjunction I used os.fdopen() to get a wrapper around file
> properties (write & read methods, and so on...) but 'nam
On Aug 28, 1:55 pm, billiejoex <[EMAIL PROTECTED]> wrote:
> In conjunction I used os.fdopen() to get a wrapper around file
> properties (write & read methods, and so on...) but 'name' attribute
> does not contain the correct file name. Why?
>
> >>> import os
> >>> import tempfile
> >>> fileno, nam
Hi there.
I'm trying to generate a brand new file with a unique name by using
tempfile.mkstemp().
In conjunction I used os.fdopen() to get a wrapper around file
properties (write & read methods, and so on...) but 'name' attribute
does not contain the correct file name. Why?
>>> import os
>>> impor
10 matches
Mail list logo