D
djw
Hi, c.l.p'ers-
I working on some code that creates a temporary file on Linux. I found some
code that the BDFL posted previously on the newsgroup and adapted it for my
use. I can't get the "pre-2.3" code to work.
try:
make_temp_file = tempfile.mkstemp # 2.3+
except AttributeError:
def make_temp_file( suffix='', prefix='', dir='', text=False ): #pre-2.3
path = tempfile.mktemp( suffix )
fd = os.open( path, os.O_WRONLY|os.O_CREAT|os.O_EXCL, 0700 )
os.unlink( path )
return ( os.fdopen( fd, 'w+b' ), path )
Here's the error:
File "utils.py", line 583, in make_temp_file
return ( os.fdopen( fd, 'w+b' ), path )
OSError: [Errno 22] Invalid argument
Anybody have any ideas on what I am doing wrong?
Thanks,
Don
I working on some code that creates a temporary file on Linux. I found some
code that the BDFL posted previously on the newsgroup and adapted it for my
use. I can't get the "pre-2.3" code to work.
try:
make_temp_file = tempfile.mkstemp # 2.3+
except AttributeError:
def make_temp_file( suffix='', prefix='', dir='', text=False ): #pre-2.3
path = tempfile.mktemp( suffix )
fd = os.open( path, os.O_WRONLY|os.O_CREAT|os.O_EXCL, 0700 )
os.unlink( path )
return ( os.fdopen( fd, 'w+b' ), path )
Here's the error:
File "utils.py", line 583, in make_temp_file
return ( os.fdopen( fd, 'w+b' ), path )
OSError: [Errno 22] Invalid argument
Anybody have any ideas on what I am doing wrong?
Thanks,
Don