Hello,
import of engine.py is causing this error on python 2.7.x
error Traceback (most recent call last)
/home/user/opt/taof-0.3.2/<ipython-input-5-1764492aefe0> in <module>()
----> 1 import dataretrieval
/home/user/opt/taof-0.3.2/dataretrieval.py in <module>()
25 from twisted.internet import reactor
26
---> 27 import fuzzutils
28
29
/home/user/opt/taof-0.3.2/fuzzutils.pyc in <module>()
30 from logger import *
31 from xmlsettings import *
---> 32 from engine import *
33
34 #Third party libraries
/home/user/opt/taof-0.3.2/engine.py in <module>()
38 integerstrings_little_endian = []
39 for i in integerstrings:
---> 40 integerstrings_little_endian.append(pack('<I',i))
41 integerstrings_big_endian = []
42 for i in integerstrings:
error: integer out of range for 'I' format code
--------------------------------------------------------------------------------------
This is because pack('<I', -1) throws and error on python 2.7
I have solved this by converting to unsigned first:
def unsigned(x):
if ( x < 0 ):
return unpack('<I',pack('<i',x))[0]
else:
return x
#Pack integers as strings for 32bit
integerstrings_little_endian = []
for i in integerstrings:
integerstrings_little_endian.append(pack('<I',unsigned(i)))
integerstrings_big_endian = []
for i in integerstrings:
integerstrings_big_endian.append(pack('>I',unsigned(i)))
Please could you consider adding this to the upstream package?
Thank you
Michal Ambroz