<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> One example I tried was:
>
> wibble = struct.unpack("f", struct.pack("l", long(conv_str, 16)))
> OverflowError: long int too large to convert to int
You can't fit 0x80000000L into a signed 32-bit integer, use 'L' for
an unsigned one.
> If I follow the examples I have found on the net using a set value of
> 0x80000000 in them, everything works fine from the interpreter line.
This depends on the Python version: before 2.4 0x80000000
corresponds to the bit pattern you expect but will be negative.
That's why it's happy as a signed 32-bit integer.
>>> 0x80000000 == 0x80000000L
<interactive input>:1: FutureWarning: hex/oct constants > sys.maxint
will return positive values in Python 2.4 and up
...
False
--
http://mail.python.org/mailman/listinfo/python-list