We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c6cddec + ea821ac commit e955f9eCopy full SHA for e955f9e
1 file changed
surfa/io/utils.py
@@ -64,7 +64,9 @@ def write_int(file, value, size=4, signed=True, byteorder='big'):
64
byteorder : str
65
Memory byte order.
66
"""
67
- file.write(value.to_bytes(size, byteorder=byteorder, signed=signed))
+ # to avoid 'AttributeError: 'numpy.int32' object has no attribute 'to_bytes'' in numpy 2.0,
68
+ # cast numpy.int32 to a native Python int
69
+ file.write(int(value).to_bytes(size, byteorder=byteorder, signed=signed))
70
71
72
def read_bytes(file, dtype, count=1):
0 commit comments