mirror of https://gerrit.osmocom.org/pysim
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@cyberdimension.org> Change-Id: Ie45dc7ccd72fe077ba3b424f221ff4ed02db436c
This commit is contained in:
parent
84d2cb3cb3
commit
8902bcde07
|
@ -23,14 +23,17 @@
|
|||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import exceptions
|
||||
|
||||
|
||||
class NoCardError(exceptions.Exception):
|
||||
try:
|
||||
# This is for compatibility with python 2 and 3
|
||||
from exceptions import Exception
|
||||
except:
|
||||
pass
|
||||
|
||||
class ProtocolError(exceptions.Exception):
|
||||
class NoCardError(Exception):
|
||||
pass
|
||||
|
||||
class ReaderError(exceptions.Exception):
|
||||
class ProtocolError(Exception):
|
||||
pass
|
||||
|
||||
class ReaderError(Exception):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue