Add binary mode for writing
Useless on Linux, can prevent data corruption on windows.
This commit is contained in:
parent
ba02773ce1
commit
cf6774afe6
1 changed files with 2 additions and 2 deletions
|
|
@ -206,7 +206,7 @@ class Boobill(ReplApplication):
|
||||||
print(buf)
|
print(buf)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
with open(dest, 'w') as f:
|
with open(dest, 'wb') as f:
|
||||||
f.write(buf)
|
f.write(buf)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print('Unable to write bill in "%s": %s' % (dest, e), file=self.stderr)
|
print('Unable to write bill in "%s": %s' % (dest, e), file=self.stderr)
|
||||||
|
|
@ -223,7 +223,7 @@ class Boobill(ReplApplication):
|
||||||
print(buf)
|
print(buf)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
with open(dest, 'w') as f:
|
with open(dest, 'wb') as f:
|
||||||
f.write(buf)
|
f.write(buf)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print('Unable to write bill in "%s": %s' % (dest, e), file=self.stderr)
|
print('Unable to write bill in "%s": %s' % (dest, e), file=self.stderr)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue