file descriptors & fdopen

Scott Frankel frankel at
Mon Dec 6 20:27:18 CET 2004

Why does os.fdopen('foo.txt', 'w') require an integer?
Ultimately, I want to create a new file on disk.

Funny, I can't seem to suss-out how to create a new file without 
to os.system('touch foo.txt').  ... Or maybe not so funny ...

 >>> foo = os.fdopen('foo.txt', 'w')
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: an integer is required

Thanks in advance!

More information about the Python-list mailing list