> Same here. In fact, is there a good reason to have mkstemp() return the
> fd (except backward compatibility)?
Except for backwards compatibility: is there a good reason to keep
os.mkstemp at all?
The tradition is that all APIs in os expose the "system" calls as-is,
i.e. they don't try to adjus
Greg Ewing wrote:
[EMAIL PROTECTED] wrote:
I'm not disagreeing with you, but it seems odd that os.fdopen doesn't
simply
obey the mode of the file descriptor it receives as its argument
I'm not even sure if it's possible to find out the mode
that a file descriptor was opened with -- is it?
[EMAIL PROTECTED] wrote:
I'm not disagreeing with you, but it seems odd that os.fdopen doesn't simply
obey the mode of the file descriptor it receives as its argument
I'm not even sure if it's possible to find out the mode
that a file descriptor was opened with -- is it?
Certainly there's no w
Guido van Rossum wrote:
IMO mkstemp() is a major pain because you have to use raw file
descriptors on the return value. I'd much rather recommend
[Named]TemporaryFile which return streams.
The problem with NamedTemporaryFile is that it deletes
the file as soon as you close it, which makes the
n
On Tue, 29 Apr 2008 17:15:11 +1200, Greg Ewing wrote:
> [EMAIL PROTECTED] wrote:
>> Guido> Have we documented the alternatives well enough?
>>
>> I suppose we could document explicitly how to use mkstemp() in place of
>> mktemp(), but the difference in return value is fairly modest:
>
> I'd
[EMAIL PROTECTED] wrote:
Guido> Have we documented the alternatives well enough?
I suppose we could document explicitly how to use mkstemp() in place of
mktemp(), but the difference in return value is fairly modest:
I'd like to see a variation of mkstemp() that returns
a file object inste
Guido> I'd be much happier if there was a standard API in tempfile.py
Guido> that did that for you, so you wouldn't have to understand
Guido> fdopen().
That can be arranged:
http://bugs.python.org/issue2717
Guido> (Your example is wrong BTW, the open mode would have to be
I'd be much happier if there was a standard API in tempfile.py that
did that for you, so you wouldn't have to understand fdopen(). (Your
example is wrong BTW, the open mode would have to be something like
'rb+' or 'wb+'.)
On Mon, Apr 28, 2008 at 4:35 PM, <[EMAIL PROTECTED]> wrote:
>
> Guido>
Guido> IMO mkstemp() is a major pain because you have to use raw file
Guido> descriptors on the return value. I'd much rather recommend
Guido> [Named]TemporaryFile which return streams.
Why not:
fd, fname = tempfile.mkstemp()
f = os.fdopen(fd)
Seems fairly straightforward to
IMO mkstemp() is a major pain because you have to use raw file
descriptors on the return value. I'd much rather recommend
[Named]TemporaryFile which return streams.
On Mon, Apr 28, 2008 at 4:17 PM, <[EMAIL PROTECTED]> wrote:
>
> Guido> Have we documented the alternatives well enough?
>
> I s
Guido> Have we documented the alternatives well enough?
I suppose we could document explicitly how to use mkstemp() in place of
mktemp(), but the difference in return value is fairly modest:
>>> tempfile.mktemp()
'/var/folders/5q/5qTPn6xq2RaWqk+1Ytw3-U+++TI/-Tmp-/tmpV_5OLi'
>>>
Have we documented the alternatives well enough? In most cases
NamedTemporaryFile will work, but sometimes you will have to create a
directory and pick names therein. Doing that so that it will always be
cleaned up properly is a bit of a trick, involving an isdir() check
and a shutil.rmtree() call.
Benjamin Peterson wrote:
> On Mon, Apr 28, 2008 at 7:02 AM, Neal Becker <[EMAIL PROTECTED]> wrote:
>> IIUC, current ioctl is not capable of handling arbitrary argument types.
>> This code will allow any arg type (such as structures with pointers to
>> embedded structures).
>
> Please submit thi
On Mon, Apr 28, 2008 at 7:02 AM, Neal Becker <[EMAIL PROTECTED]> wrote:
> IIUC, current ioctl is not capable of handling arbitrary argument types.
> This code will allow any arg type (such as structures with pointers to
> embedded structures).
Please submit this patch to the tracker.
--
Cheer
IIUC, current ioctl is not capable of handling arbitrary argument types.
This code will allow any arg type (such as structures with pointers to
embedded structures).
The code for _IOC is taken from linux and might not be portable.
from ctypes import *
libc = CDLL ('/lib/libc.so.6')
#print libc.i
Brett Cannon python.org> writes:
> As http://bugs.python.org/issue2705 points out, though, since the
> function has been documented as being allowed to be overridden, this
> potentially breaks existing showwarning() implementations. That means
> something needs to change.
>
> One option is to int
16 matches
Mail list logo