Change in pysim[master]: Surround by try except to continue programming of other parameters

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

herlesupreeth gerrit-no-reply at lists.osmocom.org
Tue Sep 29 10:52:09 UTC 2020


herlesupreeth has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/20313 )


Change subject: Surround by try except to continue programming of other parameters
......................................................................

Surround by try except to continue programming of other parameters

Currently, if programming of a certain EF fails the program execution stops
at that point and prevents programming of subsequent parametes in the program
flow. Therefore, surrounding by try catch ensures programming of all
non-failing EFs and displays error messages for the failing EFs.

Change-Id: I5a200e0594dc29cb6fdaf8966f4a11adeddcd80f
---
M pySim/cards.py
1 file changed, 12 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/13/20313/1

diff --git a/pySim/cards.py b/pySim/cards.py
index f2a3d2a..d596e22 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -1162,16 +1162,22 @@
 			# update EF.EHPLMN in ADF.USIM
 			if self.file_exists(EF_USIM_ADF_map['EHPLMN']):
 				if p.get('mcc') and p.get('mnc'):
-					sw = self.update_ehplmn(p['mcc'], p['mnc'])
-					if sw != '9000':
-						print("Programming EHPLMN failed with code %s"%sw)
+					try:
+						sw = self.update_ehplmn(p['mcc'], p['mnc'])
+						if sw != '9000':
+							print("Programming EHPLMN failed with code %s"%sw)
+					except Exception as e:
+						print("EHPLMN: Can't update file -- " + str(e))
 
 			# update EF.ePDGId in ADF.USIM
 			if self.file_exists(EF_USIM_ADF_map['ePDGId']):
 				if p.get('epdgid'):
-					sw = self.update_epdgid(p['epdgid'])
-					if sw != '9000':
-						print("Programming ePDGId failed with code %s"%sw)
+					try:
+						sw = self.update_epdgid(p['epdgid'])
+						if sw != '9000':
+							print("Programming ePDGId failed with code %s"%sw)
+					except Exception as e:
+						print("ePDGId: Can't update file -- " + str(e))
 
 		return
 

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/20313
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I5a200e0594dc29cb6fdaf8966f4a11adeddcd80f
Gerrit-Change-Number: 20313
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200929/e93ceab2/attachment.htm>


More information about the gerrit-log mailing list