Skip to content

Commit 5ff97b3

Browse files
joeeojbrandon-rhodes
authored andcommitted
Change file mode to wb for windows computers (brandon-rhodes#8)
Without write binary mode on windows machine, csv files have an extra newline appended. wb mode should have no effect on Unix machines (https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files)
1 parent 643cd48 commit 5ff97b3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

build/BUILD.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def main():
5353

5454
print('Writing "titles.csv"')
5555

56-
with open('../data/titles.csv', 'w') as f:
56+
with open('../data/titles.csv', 'wb') as f:
5757
output = csv.writer(f)
5858
output.writerow(('title', 'year'))
5959
for raw_title in interesting_titles:
@@ -69,7 +69,7 @@ def main():
6969
line = next(lines)
7070
assert next(lines) == b'==================\n'
7171

72-
output = csv.writer(open('../data/release_dates.csv', 'w'))
72+
output = csv.writer(open('../data/release_dates.csv', 'wb'))
7373
output.writerow(('title', 'year', 'country', 'date'))
7474

7575
for line in lines:
@@ -100,7 +100,7 @@ def main():
100100

101101
print('Finished writing "release_dates.csv"')
102102

103-
output = csv.writer(open('../data/cast.csv', 'w'))
103+
output = csv.writer(open('../data/cast.csv', 'wb'))
104104
output.writerow(('title', 'year', 'name', 'type', 'character', 'n'))
105105

106106
for role_type, filename in (

0 commit comments

Comments
 (0)