Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable correct exporting of char data but with passing CI #99

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pyulog/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ def _make_data_items(self):
field_type = field.type_str
field_encoding = self._UNPACK_TYPES[field_type][0]
field_data = data_set.data[field_name][i_sample]

# For char type, convert np.int8 into single bytes() object
# so that struct.pack can handle it
if field_encoding == 'c':
field_data = bytes(chr(field_data), 'utf-8')

data.extend(struct.pack('<' + field_encoding, field_data))

header = struct.pack('<HB', len(data), self.MSG_TYPE_DATA)
Expand Down
Loading