mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-30 12:35:31 +03:00
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:
committed by
laforge
parent
84d2cb3cb3
commit
8902bcde07
@@ -23,14 +23,17 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import exceptions
|
try:
|
||||||
|
# This is for compatibility with python 2 and 3
|
||||||
|
from exceptions import Exception
|
||||||
class NoCardError(exceptions.Exception):
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class ProtocolError(exceptions.Exception):
|
class NoCardError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class ReaderError(exceptions.Exception):
|
class ProtocolError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class ReaderError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user