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:
@@ -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:
|
||||
|
@@ -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()
|
||||
|
@@ -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:
|
||||
|
@@ -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()
|
||||
|
@@ -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()
|
||||
|
@@ -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()
|
||||
|
@@ -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):
|
||||
|
Reference in New Issue
Block a user