Skip to content

PySight fails to identify when a list file is binary #19

@liorgolgher

Description

@liorgolgher

When asking PySight to parse a binary list file, I get the following error:

File "/state/partition1/home/pblab/data/Hagai/python-pysight/src/pysight/main.py", line 194, in run
return main_data_readout(gui_as_object)
File "/state/partition1/home/pblab/data/Hagai/python-pysight/src/pysight/main.py", line 43, in main_data_readout
cur_file.run()
File "/state/partition1/home/pblab/data/Hagai/python-pysight/src/pysight/ascii_list_file_parser/fileIO_tools.py", line 65, in run
self.data: np.ndarray = self.read_lst(num_of_items=num_of_items)
File "/state/partition1/home/pblab/data/Hagai/python-pysight/src/pysight/ascii_list_file_parser/fileIO_tools.py", line 337, in read_lst
count=num_of_lines_to_read).astype('{}U'.format(data_length))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc in position 11: ordinal not in range(128)

The exact hexadecimal value varies of course from one list file to another, but the bug has been consistent across several imaging sessions:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xda in position 16: ordinal not in range(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xda in position 10: ordinal not in range(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb8 in position 15: ordinal not in range(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xda in position 8: ordinal not in range(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xda in position 12: ordinal not in range(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xda in position 0: ordinal not in range(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xda in position 4: ordinal not in range(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0x82 in position 2: ordinal not in range(128)

And so forth.

Oddly enough, the error takes longer (a minute versus a few seconds) to appear for a specific list file [1]. That delay is gone once running PySight in Debug mode, i.e. once checking the debug checkbox in PySight's advanced GUI window.

With a few other list files [2] a different error was reported:

...
File "/state/partition1/home/pblab/data/Hagai/python-pysight/src/pysight/ascii_list_file_parser/fileIO_tools.py", line 65, in run
self.data: np.ndarray = self.read_lst(num_of_items=num_of_items)
File "/state/partition1/home/pblab/data/Hagai/python-pysight/src/pysight/ascii_list_file_parser/fileIO_tools.py", line 330, in read_lst
raise NotImplementedError('Binary files are still not supported.')
NotImplementedError: Binary files are still not supported.

All these errors were observed using pydev debugger (build 172.3757.67), as the GUI is still pixelated when run ordinarily.

Thanks!
Lior

[1] 2018-04-24/940 nm wo OPO bypass/LPT (...) - 010.lst
[2] 2018-05-23/Setup/LPT (...) - 024.lst
2018-05-23/Setup/LPT (...) - 023.lst
2018-05-23/Setup/LPT (...) - 022.lst

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions