if len(argv) != 4:
error(usage(argv[0]))
- txt_credits_data = unicode(as_txt_credits(contributors)).encode("utf-8")
+ if sys.version_info[0] < 3:
+ txt_credits_data = unicode(as_txt_credits(contributors)).encode("utf-8")
+ else:
+ txt_credits_data = str(as_txt_credits(contributors)).encode("utf-8")
txt_credits = open(argv[1], "w")
txt_credits.write(txt_credits_data)
- php_credits_data = unicode(as_php_credits(contributors, argv[2])).encode("utf-8")
+ if sys.version_info[0] < 3:
+ php_credits_data = unicode(as_php_credits(contributors, argv[2])).encode("utf-8")
+ else:
+ php_credits_data = str(as_php_credits(contributors, argv[2])).encode("utf-8")
php_credits = open(argv[2], "w")
php_credits.write(php_credits_data)
- php_blanket_data = unicode(as_php_blanket(contributors, argv[3])).encode("utf-8")
+ if sys.version_info[0] < 3:
+ php_blanket_data = unicode(as_php_blanket(contributors, argv[3])).encode("utf-8")
+ else:
+ php_blanket_data = str(as_php_blanket(contributors, argv[3])).encode("utf-8")
php_blanket = open(argv[3], "w")
php_blanket.write(php_blanket_data)
- warning_data = unicode(collate_incomplete(contributors) + '\n').encode("utf-8")
+ if sys.version_info[0] < 3:
+ warning_data = unicode(collate_incomplete(contributors) + '\n').encode("utf-8")
+ else:
+ warning_data = str(collate_incomplete(contributors) + '\n').encode("utf-8")
sys.stderr.write(warning_data)
os.chdir(from_dir)
found = False
-for line in input.xreadlines():
+for line in input:
if found and not emptyline.match(line) and not commentline.match(line):
# The contents of the final line containing the file name
# are ' X <file name>', where X = 0 or 1.
# Unable to open the file, but do nothing here because
# the calling function will act on the value of 'success'.
warning('Warning in legacy_extract_metrics_info! Unable to open "%s"' % log_file)
- warning(`sys.exc_type` + ',' + `sys.exc_value`)
+ warning(repr(sys.exc_info()[0]) + ',' + repr(sys.exc_info()[1]))
if success == 0:
error("Failed to extract metrics info from %s" % log_file)
except:
warning('Warning in extract_resolution! Unable to open "%s"' % log_file)
- warning(`sys.exc_type` + ',' + `sys.exc_value`)
+ warning(repr(sys.exc_info()[0]) + ',' + repr(sys.exc_info()[1]))
# This is safe because both fontsize and magnification have
# non-zero default values.
# Unable to open the file, but do nothing here because
# the calling function will act on the value of 'success'.
warning('Warning in legacy_latex_file! Unable to open "%s"' % latex_file)
- warning(`sys.exc_type` + ',' + `sys.exc_value`)
+ warning(repr(sys.exc_info()[0]) + ',' + repr(sys.exc_info()[1]))
for line in f.readlines():
if success:
if hr != winerror.ERROR_IO_PENDING:
data = data + buffer
- except pywintypes.error, e:
+ except pywintypes.error as e:
if e.args[0] != winerror.ERROR_BROKEN_PIPE:
error = 1
break
except:
warning('check_latex_log: Unable to open "%s"' % log_file)
- warning(`sys.exc_type` + ',' + `sys.exc_value`)
+ warning(repr(sys.exc_info()[0]) + ',' + repr(sys.exc_info()[1]))
return error_pages