Skip to content

struct.error: unpack requires a buffer of 4 bytes #302

@hnphien

Description

@hnphien

Hi @adamreeve ,

I am currently using nptdms to extract data from a 50MB TDMS file. However, I am encountering an issue with the extraction process, and would appreciate any assistance in resolving the matter. It is working properly with others.

[ISSUE]
Traceback (most recent call last):
File "C:\Users\hnphien\Documents\converter\program.py", line 64, in
run(log=proc_logger, config=proc_config)
File "C:\Users\hnphien\Documents\converter\program.py", line 40, in run
try_convert(
File "C:\Users\hnphien\Documents\converter\src\ft_converter\convert.py", line 60, in try_convert
dataframes = _convert(
File "C:\Users\hnphien\Documents\converter\src\ft_converter\convert.py", line 42, in _convert
df_hys = process_tdms(log, file_path, cache_file_path)
File "C:\Users\hnphien\Documents\converter\src\ft_converter\tdms_processor\tdms_process.py", line 27, in process_tdms
tdms: TdmsFile = TdmsFile(file_path)
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\tdms.py", line 131, in init
self._read_file(self._reader, read_metadata_only, keep_open)
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\tdms.py", line 289, in _read_file
self._read_data(tdms_reader)
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\tdms.py", line 301, in _read_data
for chunk in tdms_reader.read_raw_data():
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\reader.py", line 119, in read_raw_data
for chunk in segment.read_raw_data(self._file):
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\tdms_segment.py", line 244, in read_raw_data
for chunk in self._read_data_chunks(f, data_objects, self.num_chunks):
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\tdms_segment.py", line 359, in _read_data_chunks
for chunk in reader.read_data_chunks(file, data_objects, num_chunks):
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\base_segment.py", line 52, in read_data_chunks
yield self._read_data_chunk(file, data_objects, chunk)
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\tdms_segment.py", line 482, in _read_data_chunk
object_data[obj.path] = obj.read_values(file, number_values, self.endianness)
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\tdms_segment.py", line 562, in read_values
return self.data_type.read_values(file, number_values, endianness)
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\types.py", line 219, in read_values
offsets.append(Uint32.read(file, endianness))
File "c:\Users\hnphien.conda\envs\wlt\lib\site-packages\nptdms\types.py", line 98, in read
return _struct_unpack(endianness + cls.struct_declaration, read_bytes)[0]
struct.error: unpack requires a buffer of 4 bytes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions