Problems using struct pack/unpack in files, and reading them.

Ian Kelly ian.g.kelly at gmail.com
Fri Nov 13 16:00:36 EST 2015


On Fri, Nov 13, 2015 at 1:15 PM, kent nyberg <kent at z-sverige.nu> wrote:
> Even with that, it still gets wrong.
> I also tried .read()[RegisterAX:RegisterAX+4]

When you call read for the second time, are you just reading the same
file again without closing or seeking it in the interim? If that's the
case, then you would get an empty string the second time, which would
explain your error.

Either retain the read data between calls, or call seek(0) before
reading it again.



More information about the Python-list mailing list