In <[EMAIL PROTECTED]>, flamesrock wrote: > os.path.getsize(infile) <= infile.tell() > > Because that returns the error: > # File "/usr/lib/python2.3/posixpath.py", line 142, in getsize > # return os.stat(filename).st_size > #TypeError: coercing to Unicode: need string or buffer, file found > for me.
This error message gives a good hint what's wrong with your code snippet. >>> f = open('tmp.txt') >>> os.path.getsize(f) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.3/posixpath.py", line 142, in getsize return os.stat(filename).st_size TypeError: coercing to Unicode: need string or buffer, file found Something expected a string instead of a file object. >>> os.path.getsize("tmp.txt") 28190L Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list