transitland / transitland-processing-animation

Animating scheduled transit trips using the Transitland API and Processing
MIT License
279 stars 55 forks source link

Fix operator name encoding error #8

Closed mmmaia closed 6 years ago

mmmaia commented 6 years ago

When trying to use transitflow with operators like o-6fes-empresapublicadetransportesecirculação it fails with 'ascii' codec can't encode characters in position 42-43: ordinal not in range(128) (running on macOS Sierra Terminal Version 2.7.3)

This PR converts operator name from <type 'str'> to <type 'unicode'> before trying to encode it.

willgeary commented 6 years ago

Thank you @mmmaia! Will review.

willgeary commented 6 years ago

Confirming that I run into the same problem with --operator=o-6fes-empresapublicadetransportesecirculação

willgeary commented 6 years ago

This PR does solve the problem for --operator=o-6fes-empresapublicadetransportesecirculação, however it introduces a new problem for other operators which don't need to be converted. For example, --operator=o-9q9-bart returns an error when it previously ran without any errors.

I'm going to close this PR and incorporate your idea into a try/except block, so that operators such as o-9q9-bart continue to work and operators which need to be converted to unicode such as o-6fes-empresapublicadetransportesecirculação work, too. Thank you for it, @mmmaia !

mmmaia commented 6 years ago

Thanks for the review and the new fix @willgeary