-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error with non-txt-files in zip #23
Comments
Hi @polettif. Thanks for raising this issue. e083a15 fixes this error. The function now ignores non text files when reading the GTFS feed, and raises an informative warning message explaining that these files were ignored. library(gtfsio)
ggl = import_gtfs(system.file("extdata", "ggl_gtfs.zip", package = "gtfsio"))
dir.create("gtfs_test")
data.table::fwrite(ggl$agency, "gtfs_test/agency.txt")
writeLines("dummy", "gtfs_test/nontxt.html")
zip::zip("gtfs_test.zip", list.files("gtfs_test", full.names = T), mode = "cherry-pick")
g = import_gtfs("gtfs_test.zip")
#> Warning: Found non .txt files when attempting to read the GTFS feed: nontxt.html
#> These files have been ignored and were not imported to the GTFS object.
g
#> $agency
#> agency_id agency_name agency_url agency_timezone
#> 1: agency001 Transit Agency http://www.transitcommuterbus.com/ PST
#> agency_lang
#> 1: en |
Thanks for the quick resolution! |
No worries, it's my pleasure. I'll probably submit a new gtfsio version with this fix to CRAN by the end of the week, but the problem is currently solved by installing the dev version. |
As mentioned in tidytransit issue #179 gtfsio has an issue with feeds containing file extensions other than txt. The issue is around import_gtfs#117 where "txt" is removed and later re-added, even if it hasn't been removed previously.
I know files other than txt are not gtfs standard, I'd still suggest simply ignoring those files (something like the workaround in the linked issue) instead of throwing an error.
The text was updated successfully, but these errors were encountered: