laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/41669?usp=email )
Change subject: pySim.esim.saip: Fix compatibility with pytohn < 3.11 ......................................................................
pySim.esim.saip: Fix compatibility with pytohn < 3.11
In python up to 3.10, the byteorder argument of the int.to_bytes() method was mandatory, even if the length of the target byte sequence is 1 and there factually is no byteorder.
https://docs.python.org/3.10/library/stdtypes.html#int.to_bytes vs https://docs.python.org/3.11/library/stdtypes.html#int.to_bytes
See also: https://discourse.osmocom.org/t/assistance-required-with-saip-pysim-tool-err...
Change-Id: I8ba29d42c8d7bf0a36772cc3370eff1f6afa879f --- M pySim/esim/saip/__init__.py 1 file changed, 3 insertions(+), 3 deletions(-)
Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index c7f3e75..1c0c715 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -183,7 +183,7 @@ self.file_type = template.file_type self.fid = template.fid self.sfi = template.sfi - self.arr = template.arr.to_bytes(1) + self.arr = template.arr.to_bytes(1, 'big') if hasattr(template, 'rec_len'): self.rec_len = template.rec_len else: @@ -227,7 +227,7 @@ fileDescriptor['shortEFID'] = bytes([self.sfi]) if self.df_name: fileDescriptor['dfName'] = self.df_name - if self.arr and self.arr != self.template.arr.to_bytes(1): + if self.arr and self.arr != self.template.arr.to_bytes(1, 'big'): fileDescriptor['securityAttributesReferenced'] = self.arr if self.file_type in ['LF', 'CY']: fdb_dec['file_type'] = 'working_ef' @@ -264,7 +264,7 @@ if self.read_and_update_when_deact: spfi |= 0x40 # TS 102 222 Table 5 if spfi != 0x00: - pefi['specialFileInformation'] = spfi.to_bytes(1) + pefi['specialFileInformation'] = spfi.to_bytes(1, 'big') if self.fill_pattern: if not self.fill_pattern_repeat: pefi['fillPattern'] = self.fill_pattern