Assistance required with SAIP pysim tool error while adding applets to exiting upp.der

Hi,

I am working with JavaCard applets and attempting to create a new upp.der file by adding these applets to an existing upp.der file. For this, I tried using the SAIP pysim tool, but I encountered the following error:

root@madhu:/home/madhu/pysim# ./contrib/saip-tool.py /media/sf_ubuntu/TS48V1-A-UNIQUE.der add-app --output-file upp_with_app.der --applet-file app.cap --aid '112233445566666666666'
Traceback (most recent call last):
  File "/home/madhu/pysim/./contrib/saip-tool.py", line 458, in <module>
    pes = ProfileElementSequence.from_der(f.read())
  File "/usr/local/lib/python3.10/dist-packages/pySim/esim/saip/__init__.py", line 1672, in from_der
    inst.parse_der(der)
  File "/usr/local/lib/python3.10/dist-packages/pySim/esim/saip/__init__.py", line 1545, in parse_der
    self.pe_list.append(ProfileElement.from_der(first_tlv, pe_sequence=self))
  File "/usr/local/lib/python3.10/dist-packages/pySim/esim/saip/__init__.py", line 557, in from_der
    inst._post_decode()
  File "/usr/local/lib/python3.10/dist-packages/pySim/esim/saip/__init__.py", line 661, in _post_decode
    self.pe2files()
  File "/usr/local/lib/python3.10/dist-packages/pySim/esim/saip/__init__.py", line 648, in pe2files
    file = File(k, v, template.files_by_pename.get(k, None))
  File "/usr/local/lib/python3.10/dist-packages/pySim/esim/saip/__init__.py", line 131, in __init__
    self.from_template(self.template)
  File "/usr/local/lib/python3.10/dist-packages/pySim/esim/saip/__init__.py", line 186, in from_template
    self.arr = template.arr.to_bytes(1)
TypeError: to_bytes() missing required argument 'byteorder' (pos 2)
root@madhu:/home/madhu/pysim# 

I followed the below document link
https://downloads.osmocom.org/docs/pysim/master/html/saip-tool.html

Thanks & Regards,
Madhushree.

Dear Madhushree,

this is a discussion forum and not an issue tracker. I suggest you report [suspected] bugs to the issue tracker at Issues - pySim - Open Source Mobile Communications

Side note, unrelated to your problem: It is very dangerous to run code as root that has no reason to run as root. There’s nothing in pysim requiring root privileges, so it should be run as normal user.

https://gerrit.osmocom.org/c/pysim/+/41669 contains a proposed fix, but let’s please move this entire discussion to a redmine issue, as requested above

I am not able to log in to https://gerrit.osmocom.org/c/pysim/+/41669. The site keeps asking me to activate my account, but I have not received any activation email.

I really need some help with this. I tried downgrading Python to resolve compatibility issues. After fixing many environment and dependency problems, I am now facing the following error while running the pySim SAIP tool.
madhu@ubuntu22:~/pysim$ python3.9 contrib/saip-tool.py /media/sf_ubuntu/TS48V1-A-UNIQUE.der info --apps
Traceback (most recent call last):
File “/home/madhu/pysim/contrib/saip-tool.py”, line 458, in
pes = ProfileElementSequence.from_der(f.read())
File “/home/madhu/pysim/pySim/esim/saip/init.py”, line 1672, in from_der
inst.parse_der(der)
File “/home/madhu/pysim/pySim/esim/saip/init.py”, line 1545, in parse_der
self.pe_list.append(ProfileElement.from_der(first_tlv, pe_sequence=self))
File “/home/madhu/pysim/pySim/esim/saip/init.py”, line 557, in from_der
inst._post_decode()
File “/home/madhu/pysim/pySim/esim/saip/init.py”, line 661, in _post_decode
self.pe2files()
File “/home/madhu/pysim/pySim/esim/saip/init.py”, line 648, in pe2files
file = File(k, v, template.files_by_pename.get(k, None))
File “/home/madhu/pysim/pySim/esim/saip/init.py”, line 131, in init
self.from_template(self.template)
File “/home/madhu/pysim/pySim/esim/saip/init.py”, line 186, in from_template
self.arr = template.arr.to_bytes(1)
TypeError: to_bytes() missing required argument ‘byteorder’ (pos 2)

I am looking for guidance on the correct and recommended steps to install and use the pySim.esim.saip tool properly.

Sorry for posting this question here again. I tried to raise it on the official issue tracker, but I am unable to log in because the account activation email has not been received yet.

Any help or direction would be greatly appreciated.

Nobody has asked you to log into gerrit. It is a code review site for our developers/contributors. The patches can be downloaded publicly without any login.

I had asked you to file an issue (bug report) in the redmine on projects.osmocom.org in the pySim project and continue the discussion there. Since you ignore my request and continue here, I will mirror that and ignore your communication here. THis is a discussion forum and not a bug tracker.