Help please with binary file read

Stewart Arnold stewartarnold at DELETEIT.yahoo.com
Sun Jan 1 10:35:44 EST 2006


I'm trying to convert a Real Basic routine into Python and I can't read the 
long integer data from a file.

Here is the Real Basic code:

     b=f.OpenAsBinaryFile
     b.LittleEndian=True
     i=b.ReadByte
     titles=b.ReadLong
     shows=b.ReadLong
     i=b.ReadLong

And here is my code:

     db = open('otter.db', 'rb')
     null = db.read(1)  # read empty byte
     titles = db.read(4)
     shows = db.read(4)
     null = db.read(1)  # read empty byte

     print titles

When I print titles I get ascii pictures. How do I convert 'titles' to an 
integer I can loop through?
Is db.read(4) correct for ReadLong?

Thanks!

PS. here's the file I'm working with http://otterprojectonline.info/otter.db






More information about the Python-list mailing list