AFM-SPM / TopoStats

An AFM image analysis program to batch process data and obtain statistics from images
https://afm-spm.github.io/TopoStats/
GNU Lesser General Public License v3.0
55 stars 10 forks source link

[Bug]: Gwy file not loading #832

Closed SylviaWhittle closed 1 month ago

SylviaWhittle commented 1 month ago

Checklist

Describe the bug

Some .gwy files fail to load.

Copy of the output

image

Include the configuration file

Default config with .gwy selected.

To Reproduce

Run TopoStats on this file: https://drive.google.com/file/d/1CWQnVYJg0UXuJLqZ4xWYbnjDM5v2u5N-/view?usp=share_link. Not to be shared outside the University.

TopoStats Version

Git main branch

Python Version

3.11

Operating System

MacOS M1/M2 (post-2021)

Python Packages

N/A

SylviaWhittle commented 1 month ago

I believe I have found the root cause and a solution.

The crash is caused by the byte 0xb5 (the micro symbol) not being able to be read by read_null_terminated_string. This is due to said byte not being in the utf-8 encoding that is default for the function. I resolved this by using the latin1 encoding which is able to handle said character.

I think the fix should try utf-8 as it supports more characters than latin1, but to try latin1 after a failed read of utf-8. Branch & commit to follow.