Permalink
Browse files

Changed all modes from 'wb' to 'w' to make it work for both Python an…

…d Python3 (#27)
  • Loading branch information...
1 parent c1d5dcc commit df0f008ae8754010fe54916cff6e5a658d7c5b94 @webparameter webparameter committed with Mar 21, 2017
Showing with 5 additions and 3 deletions.
  1. +5 −3 build/BUILD.py
View
@@ -8,6 +8,7 @@
split_on_tabs = re.compile(b'\t+').split
+
def main():
os.chdir(os.path.dirname(os.path.abspath(__file__)))
if not os.path.isdir('../data'):
@@ -53,7 +54,7 @@ def main():
print('Writing "titles.csv"')
- with open('../data/titles.csv', 'wb') as f:
+ with open('../data/titles.csv', 'w') as f:
output = csv.writer(f)
output.writerow(('title', 'year'))
for raw_title in interesting_titles:
@@ -69,7 +70,7 @@ def main():
line = next(lines)
assert next(lines) == b'==================\n'
- output = csv.writer(open('../data/release_dates.csv', 'wb'))
+ output = csv.writer(open('../data/release_dates.csv', 'w'))
output.writerow(('title', 'year', 'country', 'date'))
for line in lines:
@@ -100,7 +101,7 @@ def main():
print('Finished writing "release_dates.csv"')
- output = csv.writer(open('../data/cast.csv', 'wb'))
+ output = csv.writer(open('../data/cast.csv', 'w'))
output.writerow(('title', 'year', 'name', 'type', 'character', 'n'))
for role_type, filename in (
@@ -188,6 +189,7 @@ def not_a_real_movie(line):
match_title = re.compile(r'^(.*) \((\d+)(/[IVXL]+)?\)$').match
+
def parse_title(raw_title):
try:
title = raw_title.decode('ascii')

0 comments on commit df0f008

Please sign in to comment.