hunterakins / pyat

Provide Python functions for reading and writing the files required for the Acoustics Toolbox programs (KRAKEN, BELLHOP, SCOOTER). Also defines objects that represent the basic elements of an acoustic simulation.
GNU General Public License v3.0
29 stars 9 forks source link

Error with read_write.read_modes #3

Closed John-Ragland closed 2 years ago

John-Ragland commented 2 years ago

I'm running python 3.7.10 on macOS 12.0.1

When running pyat/test/krak_test/test.py I get the following error:

Traceback (most recent call last):
  File "test.py", line 89, in <module>
    modes = read_modes(**options)
  File "*/pyat/pyat/readwrite.py", line 1225, in read_modes
    k    = unpack('f'*2*M, f.read(4*2*M))
struct.error: unpack requires a buffer of 296 bytes

In trying to debug it:

line 1224 f.seek(rec * lrecl)

with open(filename, 'rb') as f:
    f.seek(0)
    test = f.read()

print(len(test))
>>>70400

one other note, I was able to successfully use this code previously a couple of months ago, but now it doesn't work. Unsure if this is due to changes in the code or changes to my local working environment since then

John-Ragland commented 2 years ago

Just checked out to commit from May 2021 'who knows' which was back when it was working for me and I get the same error, so I don't believe it is something that has changed in the code since then.

John-Ragland commented 2 years ago

Turns out it was a problem with my at installation and unrelated to pyat 🤦‍♂️

closing issue