Comment 1 for bug 1656371

Revision history for this message
Barry Warsaw (barry) wrote :

I think the following code will do the correct thing on both file systems:

try:
    os.lseek(fp.fileno(), 0, os.SEEK_DATA)
except OSError as error:
    if error.errno != errno.ENXIO:
        raise
    # OK! There is no data in the file.
else:
    # BAD! There is unexpected data in the file.