neels has uploaded this change for review.

View Change

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 <module>
asn1 = compile_asn1_subdir('saip')
[...]
File "<frozen codecs>", 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
---
M pySim/esim/__init__.py
1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/09/42009/1
diff --git a/pySim/esim/__init__.py b/pySim/esim/__init__.py
index 35b733e..9bbaf17 100644
--- a/pySim/esim/__init__.py
+++ b/pySim/esim/__init__.py
@@ -54,6 +54,8 @@
__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:

To view, visit change 42009. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I37df3fc081e51e2ed2198876c63f6e68ecc8fcd8
Gerrit-Change-Number: 42009
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>