File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def main():
1515 transfers = {}
1616
1717 # load stops into a dict
18- with open (args .stops_file , 'rb ' ) as f :
18+ with open (args .stops_file , 'r ' ) as f :
1919 reader = csv .DictReader (f )
2020 for row in reader :
2121 if row ['parent_station' ]:
@@ -28,7 +28,7 @@ def main():
2828 }
2929
3030 # load transfer groups into a dict. duplicates will be filtered out later
31- with open (args .transfers_file , 'rb ' ) as f :
31+ with open (args .transfers_file , 'r ' ) as f :
3232 reader = csv .DictReader (f )
3333 for row in reader :
3434 if row ['from_stop_id' ] == row ['to_stop_id' ]:
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def main():
1111 args = parser .parse_args ()
1212
1313 stations = {}
14- with open (args .stations_file , 'rb ' ) as f :
14+ with open (args .stations_file , 'r ' ) as f :
1515 reader = csv .DictReader (f )
1616 for row in reader :
1717
@@ -33,11 +33,11 @@ def main():
3333 sum (v [0 ] for v in station ['stops' ].values ()) / float (len (station ['stops' ])),
3434 sum (v [1 ] for v in station ['stops' ].values ()) / float (len (station ['stops' ]))
3535 ]
36- station ['id' ] = md5 ('' .join (station ['stops' ].keys ())).hexdigest ()[:ID_LENGTH ]
36+ station ['id' ] = md5 ('' .join (station ['stops' ].keys ()). encode ( 'utf-8' ) ).hexdigest ()[:ID_LENGTH ]
3737
3838 while station ['id' ] in keyed_stations :
3939 # keep hashing til we get a unique ID
40- station ['id' ] = md5 (station ['id' ]).hexdigest ()[:ID_LENGTH ]
40+ station ['id' ] = md5 (station ['id' ]. encode ( 'utf-8' ) ).hexdigest ()[:ID_LENGTH ]
4141
4242 keyed_stations [station ['id' ]] = station
4343
You can’t perform that action at this time.
0 commit comments