1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-06 21:28:42 +02:00

python3 compatibility: except

changes 'except FooError, fe' to 'except FooError as fe'

available in python 2.6
This commit is contained in:
Michal Vyskocil
2013-04-09 11:27:02 +02:00
committed by Adrian Schröter
parent d3648be24b
commit 3a93ac6d10
16 changed files with 110 additions and 110 deletions

View File

@@ -163,7 +163,7 @@ class Ar:
self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name), prot=mmap.PROT_READ)
else:
self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name))
except EnvironmentError, e:
except EnvironmentError as e:
if e.errno == 19 or ( hasattr(e, 'winerror') and e.winerror == 5 ):
print >>sys.stderr, 'cannot use mmap to read the file, falling back to the default io'
else:

View File

@@ -152,7 +152,7 @@ if __name__ == '__main__':
import sys
try:
archq = ArchQuery.query(sys.argv[1])
except ArchError, e:
except ArchError as e:
print e.msg
sys.exit(2)
print archq.name(), archq.version(), archq.release(), archq.arch()

View File

@@ -150,7 +150,7 @@ class CpioRead:
self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name), prot = mmap.PROT_READ)
else:
self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name))
except EnvironmentError, e:
except EnvironmentError as e:
if e.errno == 19 or ( hasattr(e, 'winerror') and e.winerror == 5 ):
print >>sys.stderr, 'cannot use mmap to read the file, failing back to default'
else:

View File

@@ -167,7 +167,7 @@ if __name__ == '__main__':
import sys
try:
debq = DebQuery.query(sys.argv[1])
except DebError, e:
except DebError as e:
print e.msg
sys.exit(2)
print debq.name(), debq.version(), debq.release(), debq.arch()

View File

@@ -114,7 +114,7 @@ if __name__ == '__main__':
import sys
try:
pkgq = PackageQuery.query(sys.argv[1])
except PackageError, e:
except PackageError as e:
print e.msg
sys.exit(2)
print pkgq.name()

View File

@@ -312,7 +312,7 @@ if __name__ == '__main__':
import sys
try:
rpmq = RpmQuery.query(sys.argv[1])
except RpmError, e:
except RpmError as e:
print e.msg
sys.exit(2)
print rpmq.name(), rpmq.version(), rpmq.release(), rpmq.arch(), rpmq.url()

View File

@@ -19,7 +19,7 @@ class SafeWriter:
def write(self, s):
try:
self.__get_writer().write(s)
except UnicodeEncodeError, e:
except UnicodeEncodeError as e:
self.__get_writer().write(s.encode(self.__get_encoding()))
def __getattr__(self, name):