Baffling unpack() or read() problem......

Matthew Joyce mjoyce at xilonen.co.uk
Mon Feb 21 18:08:28 EST 2000


The code below runs perfectly on Linux on very large files of binary
data. However it believes it's got to the end of the file prematurely
in Windows after reading a variable number of sequences of 16 bytes.

Why should it work in Linux and not Windows? What am I missing?

matt
------------------------------------------
from struct import *
import sys
import string
import os.path
rawinfile=open(os.path.abspath("nt.raw"),"r")
rawstring = rawinfile.read(16)
while rawstring != "":
    unpack("4L",rawstring)
    rawstring = rawinfile.read(16)
rawinfile.close()





More information about the Python-list mailing list