New submission from Joe Cool :
os.stat on windows doesn't take an open file even though os.stat in
os.supports_fd
>>> fd = open('tmp.tmp', 'w')
>>> fd
<_io.TextIOWrapper name='tmp.tmp' mode='w' encoding='cp1252'>
>>> os.stat(fd)
Traceback (most recent call last):
File "", line 1, in
TypeErr
Eryk Sun added the comment:
You're mistaken about what `fd` is. It's a TextIOWrapper, which wraps a
BufferedWriter, which buffers a FileIO raw file object, which accesses the open
file number fd.fileno(). For example:
>>> f = open('tmp.tmp','w')
>>> os.stat(f.fileno()).st_size
0