[S] Change in pysim[master]: pySim-trace: catch StopIteration exception on trace file end
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/33962 ) Change subject: pySim-trace: catch StopIteration exception on trace file end ...................................................................... pySim-trace: catch StopIteration exception on trace file end When the trace file end is reaced, pyShark raises a StopIteration exception. Let's catch this exception and exit gracefully. Related: OS#6094 Change-Id: I6ab5689b909333531d08bf46e5dfea59b161a79e --- M pySim-trace.py 1 file changed, 18 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/62/33962/1 diff --git a/pySim-trace.py b/pySim-trace.py index 4561723..5990e32 100755 --- a/pySim-trace.py +++ b/pySim-trace.py @@ -102,7 +102,11 @@ """Main loop of tracer: Iterates over all Apdu received from source.""" while True: # obtain the next APDU from the source (blocking read) - apdu = self.source.read() + try: + apdu = self.source.read() + except StopIteration: + print("no more data, stop iteration.") + return 0 if isinstance(apdu, CardReset): self.rs.reset() -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33962 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I6ab5689b909333531d08bf46e5dfea59b161a79e Gerrit-Change-Number: 33962 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier@sysmocom.de> Gerrit-MessageType: newchange
participants (1)
-
dexter