From e7016b5b57f70b22c8261efc4d28c2ca9fb3edd8 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 30 Jan 2026 21:35:56 +0100 Subject: [PATCH] compile_asn1_subdir: filter compiled files by .asn suffix When I open the .asn file in vim, pySim should not attempt to read the vim .swp file as asn.1. File "/home/moi/osmo-dev/src/pysim/pySim/esim/saip/__init__.py", line 45, in asn1 = compile_asn1_subdir('saip') [...] File "", line 325, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0xad in position 21: invalid start byte Related: OS#6937 Change-Id: I37df3fc081e51e2ed2198876c63f6e68ecc8fcd8 --- pySim/esim/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pySim/esim/__init__.py b/pySim/esim/__init__.py index 35b733e3..9bbaf175 100644 --- a/pySim/esim/__init__.py +++ b/pySim/esim/__init__.py @@ -54,6 +54,8 @@ def compile_asn1_subdir(subdir_name:str, codec='der'): __ver = sys.version_info if (__ver.major, __ver.minor) >= (3, 9): for i in resources.files('pySim.esim').joinpath('asn1').joinpath(subdir_name).iterdir(): + if not i.name.endswith('.asn'): + continue asn_txt += i.read_text() asn_txt += "\n" #else: