Skip to content

Commit

Permalink
TeamColorizer: replaced sys.stderr.write() with print(file=sys.stderr)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elvish-Hunter committed Jun 22, 2016
1 parent 3607f8c commit e4a0eaf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions data/tools/unit_tree/TeamColorizer
Expand Up @@ -129,7 +129,7 @@ def convert_color(color, hex=False):
if color in team_colors:
return team_colors[color]
else:
sys.stderr.write("Couldn't find color '%s'.\n" % color)
print("Couldn't find color '%s'." % color, file=sys.stderr)
sys.exit(1)
new = {}
base = 10
Expand All @@ -139,15 +139,15 @@ def convert_color(color, hex=False):
try:
new[c] = int(color[c], base)
except ValueError:
sys.stderr.write("Couldn't convert color value %s='%s' using "\
"base %d. Did you forget -x?\n" %\
(c, color['mid'][c], base))
print("Couldn't convert color value %s='%s' using "\
"base %d. Did you forget -x?" %\
(c, color['mid'][c], base), file=sys.stderr)
sys.exit(1)
else:
new[c] = color['mid'][c]
if new[c] not in range(256):
sys.stderr.write("Value %s='%s' is out-of-range! Color values "\
"should be in the range [0, 255].\n" % (c, new[c]))
print("Value %s='%s' is out-of-range! Color values "\
"should be in the range [0, 255]." % (c, new[c]), file=sys.stderr)
sys.exit(1)
return { 'mid': new,
'max': { 'r': 0xff, 'g': 0xff, 'b': 0xff },
Expand Down Expand Up @@ -252,8 +252,8 @@ if __name__ == '__main__':
if not dryrun:
ret = subprocess.call(command)
if ret != 0:
sys.stderr.write("Error: Conversion command exited with error "\
"code %d.\n" % ret)
print("Error: Conversion command exited with error "\
"code %d." % ret, file=sys.stderr)
sys.exit(ret)

# TeamColorizer ends here.

0 comments on commit e4a0eaf

Please sign in to comment.