echemdata / galvani

Read proprietary file formats from electrochemical test stations
GNU General Public License v3.0
47 stars 30 forks source link

ValueError: Found b'\x82\xe0zOVP', expecting start of new VMP MODULE #39

Open SomePythonUser opened 4 years ago

SomePythonUser commented 4 years ago

I got tired of EC-lab's plotting functionality, so I've been working on my own program for live data plotting using EC-lab's .mpr files.

However, the plot sometimes stops updating and the error below is printed. ValueError: Found b'\x82\xe0zOVP', expecting start of new VMP MODULE I have no problems otherwise plotting the data, and I can restart the live plotting program and it'll work for a while until it encounters this error again.

Do you have any idea what causes this or how I could fix it? I tried looking around in the Biologic.py file, but don't really understand in which instance the error is triggered.

bcolsen commented 4 years ago

I'm not sure what would cause that error but if you're reading the file live it might change the file while you are reading it.

If it works again after restarting it's probably ok to catch the error with a try: statement in the program and just reread the file again.

SomePythonUser commented 4 years ago

Yeah, I did consider that, but I'd prefer fixing the issue if I could :b

I'll just try to catch the error. Thank you.

chatcannon commented 4 years ago

Maybe the following is happening:

  1. galvani reads the length of the data section
  2. EC-Lab writes extra data to the file
  3. galvani reads from the point where it expects the next section to be, using the outdated length information

In the case where the length of the current section is changed, the code could go back to the start of the section and reread the length. However, if change was to an earlier section then the header with the length information will also have moved. In that case I don't think there is any better solution than to go back to the start of the file and start reading again.