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/.
gnutoo gerrit-no-reply at lists.osmocom.orggnutoo has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/15503
Change subject: python3 conversion: Use python 2 and 3 compatible exceptions
......................................................................
python3 conversion: Use python 2 and 3 compatible exceptions
Without that we have:
$ python3 pySim-read.py
Using serial reader (port=/dev/ttyUSB0, baudrate=9600) interface
Traceback (most recent call last):
File "pySim-read.py", line 91, in <module>
from pySim.transport.serial import SerialSimLink
File "/home/gnutoo/work/projects/osmocom/pysim/pySim/transport/serial.py", line 29, in <module>
from pySim.exceptions import NoCardError, ProtocolError
File "/home/gnutoo/work/projects/osmocom/pysim/pySim/exceptions.py", line 26, in <module>
import exceptions
ModuleNotFoundError: No module named 'exceptions'
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
Change-Id: Ie45dc7ccd72fe077ba3b424f221ff4ed02db436c
---
M pySim/exceptions.py
1 file changed, 8 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/03/15503/1
diff --git a/pySim/exceptions.py b/pySim/exceptions.py
index 831b1c9..c57b89c 100644
--- a/pySim/exceptions.py
+++ b/pySim/exceptions.py
@@ -23,14 +23,17 @@
from __future__ import absolute_import
-import exceptions
+try:
+ # This if for compatibility with python 2 and 3
+ from exceptions import Exception
+except:
+ pass
-
-class NoCardError(exceptions.Exception):
+class NoCardError(Exception):
pass
-class ProtocolError(exceptions.Exception):
+class ProtocolError(Exception):
pass
-class ReaderError(exceptions.Exception):
+class ReaderError(Exception):
pass
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/15503
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie45dc7ccd72fe077ba3b424f221ff4ed02db436c
Gerrit-Change-Number: 15503
Gerrit-PatchSet: 1
Gerrit-Owner: gnutoo <GNUtoo at cyberdimension.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190912/975b838f/attachment.htm>