locale_database: Don't attempt to access property 'message' of IOError

IOError does not have property 'message' in Python 3. Instead of
attempting to access it, just use the string representation of
the exception object. This produces the error message possibly combined
with additional arguments in both Python 2 and Python 3.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: Icb198a409e7f80b832e474d8390b770fdeacc6c2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Ievgenii Meshcheriakov 2021-07-07 13:23:12 +02:00
parent e54faee178
commit 2300146085
2 changed files with 6 additions and 6 deletions

View File

@ -363,7 +363,7 @@ def main(args, out, err):
dict((name, ind) for ind, name in enumerate((x[0] for x in windowsIdList), 1))) dict((name, ind) for ind, name in enumerate((x[0] for x in windowsIdList), 1)))
except IOError as e: except IOError as e:
usage(err, name, usage(err, name,
'Failed to open common/supplemental/windowsZones.xml: ' + (e.message or e.args[1])) 'Failed to open common/supplemental/windowsZones.xml: ' + str(e))
return 1 return 1
except Error as e: except Error as e:
err.write('\n'.join(textwrap.wrap( err.write('\n'.join(textwrap.wrap(
@ -375,7 +375,7 @@ def main(args, out, err):
try: try:
writer = ZoneIdWriter(dataFilePath, qtPath) writer = ZoneIdWriter(dataFilePath, qtPath)
except IOError as e: except IOError as e:
err.write('Failed to open files to transcribe: {}'.format(e.message or e.args[1])) err.write('Failed to open files to transcribe: {}'.format(e))
return 1 return 1
try: try:

View File

@ -552,7 +552,7 @@ def main(args, out, err):
'qlocale_data_p.h'), 'qlocale_data_p.h'),
qtsrcdir, reader.cldrVersion) qtsrcdir, reader.cldrVersion)
except IOError as e: except IOError as e:
err.write('Failed to open files to transcribe locale data: ' + (e.message or e.args[1])) err.write('Failed to open files to transcribe locale data: ' + str(e))
return 1 return 1
try: try:
@ -582,7 +582,7 @@ def main(args, out, err):
qtsrcdir, reader.cldrVersion) qtsrcdir, reader.cldrVersion)
except IOError as e: except IOError as e:
err.write('Failed to open files to transcribe ' + calendar err.write('Failed to open files to transcribe ' + calendar
+ ' data ' + (e.message or e.args[1])) + ' data ' + str(e))
return 1 return 1
try: try:
@ -599,7 +599,7 @@ def main(args, out, err):
writer = LocaleHeaderWriter(os.path.join(qtsrcdir, 'src', 'corelib', 'text', 'qlocale.h'), writer = LocaleHeaderWriter(os.path.join(qtsrcdir, 'src', 'corelib', 'text', 'qlocale.h'),
qtsrcdir, reader.dupes) qtsrcdir, reader.dupes)
except IOError as e: except IOError as e:
err.write('Failed to open files to transcribe qlocale.h: ' + (e.message or e.args[1])) err.write('Failed to open files to transcribe qlocale.h: ' + str(e))
return 1 return 1
try: try:
@ -618,7 +618,7 @@ def main(args, out, err):
writer = Transcriber(os.path.join(qtsrcdir, 'src', 'corelib', 'text', 'qlocale.qdoc'), writer = Transcriber(os.path.join(qtsrcdir, 'src', 'corelib', 'text', 'qlocale.qdoc'),
qtsrcdir) qtsrcdir)
except IOError as e: except IOError as e:
err.write('Failed to open files to transcribe qlocale.qdoc: ' + (e.message or e.args[1])) err.write('Failed to open files to transcribe qlocale.qdoc: ' + str(e))
return 1 return 1
DOCSTRING = " QLocale's data is based on Common Locale Data Repository " DOCSTRING = " QLocale's data is based on Common Locale Data Repository "