Fix #1848515 [Faile to compile translation file on 4.1.0](https://bugs.launchpad.net/calibre/+bug/1848515)

This commit is contained in:
Kovid Goyal 2019-10-17 19:51:32 +05:30
parent c0a9270f0f
commit ca1b3967b0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -222,10 +222,12 @@ def make(filename, outfile):
# Compute output # Compute output
output = generate() output = generate()
try: try:
with open(outfile,"wb") as f: if hasattr(outfile, 'write'):
f.write(output) outfile.write(output)
else:
with open(outfile, "wb") as f:
f.write(output)
except IOError as msg: except IOError as msg:
print(msg, file=sys.stderr) print(msg, file=sys.stderr)