Use integer division when calculating DynamicStringIndicesDataField count.
authorW. Trevor King <wking@tremily.us>
Sat, 21 Jul 2012 13:12:22 +0000 (09:12 -0400)
committerW. Trevor King <wking@tremily.us>
Sat, 21 Jul 2012 13:12:22 +0000 (09:12 -0400)
In Python 3, the floating point division lead to:

    Traceback (most recent call last):
      ...
      File ".../igor/struct.py", line 255, in unpack_data
        items = [next(iterator) for i in range(self.arg_count)]
    TypeError: 'numpy.float64' object cannot be interpreted as an integer

igor/binarywave.py

index ab49cddb7b60bfecc2cec437d80cc3404854e4e0..513148bd36acc34d2a83f3fc0f12e59d630c2545 100644 (file)
@@ -477,7 +477,7 @@ class DynamicStringIndicesDataField (_DynamicField):
         bin_header = wave_data['bin_header']
         wave_header = wave_data['wave_header']
         self.string_indices_size = bin_header['sIndicesSize']
-        self.count = self.string_indices_size / 4
+        self.count = self.string_indices_size // 4
         if self.count:  # make sure we're in a text wave
             assert TYPE_TABLE[wave_header['type']] is None, wave_header
         self.setup()