Skip to content
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

GTFS importer : waiting for calendar.txt which is not mandatory (calendar_dates.txt) #459

Open
Art-Ev opened this issue Oct 26, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Art-Ev
Copy link
Contributor

Art-Ev commented Oct 26, 2023

Was using qaequilibrae but I think it's a library problem :

Trying to import a GTFS : https://data.toulouse-metropole.fr/explore/dataset/tisseo-gtfs/table/

Cannot be processed :

TypeError: 'empty' object is not subscriptable 
Traceback (most recent call last):
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\modules\public_transport_procedures\gtfs_importer.py", line 43, in add_gtfs_feed
    self.dlg2 = GTFSFeed(self.qgis_project, self._p, testing)
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\modules\public_transport_procedures\gtfs_feed.py", line 37, in __init__
    self.open_feed()
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\modules\public_transport_procedures\gtfs_feed.py", line 51, in open_feed
    self.set_data(source_path_file)
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\modules\public_transport_procedures\gtfs_feed.py", line 57, in set_data
    self.feed = self._p.new_gtfs_builder(agency="", file_path=source_path_file)
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\packages\aequilibrae\transit\transit.py", line 52, in new_gtfs_builder
    gtfs = GTFSRouteSystemBuilder(
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\packages\aequilibrae\transit\lib_gtfs.py", line 79, in __init__
    self.gtfs_data.set_feed_path(file_path)
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\packages\aequilibrae\transit\gtfs_loader.py", line 80, in set_feed_path
    self.__load_feed_calendar()
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\packages\aequilibrae\transit\gtfs_loader.py", line 512, in __load_feed_calendar
    calendar["start_date"] = [datetime.fromisoformat(format_date(i)) for i in calendar["start_date"]]
TypeError: 'empty' object is not subscriptable

GTFS importer is working only with calendar.txt but GTFS allow usage of calendar.txt with optionnal calendar_dates.txt OR only calendar_dates.txt
https://developers.google.com/transit/gtfs/reference?hl=fr#dataset_files

@Art-Ev
Copy link
Contributor Author

Art-Ev commented Oct 26, 2023

There was a calendat.txt file but empty, if I delete it aequilibrae is still looking for it :

KeyError: "There is no item named 'calendar.txt' in the archive" 
Traceback (most recent call last):
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\modules\public_transport_procedures\gtfs_importer.py", line 43, in add_gtfs_feed
    self.dlg2 = GTFSFeed(self.qgis_project, self._p, testing)
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\modules\public_transport_procedures\gtfs_feed.py", line 37, in __init__
    self.open_feed()
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\modules\public_transport_procedures\gtfs_feed.py", line 51, in open_feed
    self.set_data(source_path_file)
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\modules\public_transport_procedures\gtfs_feed.py", line 57, in set_data
    self.feed = self._p.new_gtfs_builder(agency="", file_path=source_path_file)
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\packages\aequilibrae\transit\transit.py", line 52, in new_gtfs_builder
    gtfs = GTFSRouteSystemBuilder(
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\packages\aequilibrae\transit\lib_gtfs.py", line 79, in __init__
    self.gtfs_data.set_feed_path(file_path)
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\packages\aequilibrae\transit\gtfs_loader.py", line 80, in set_feed_path
    self.__load_feed_calendar()
  File "C:\Users/a.evrard.EGIS/AppData/Roaming/QGIS/QGIS3\profiles\1_Classique/python/plugins\qaequilibrae\packages\aequilibrae\transit\gtfs_loader.py", line 510, in __load_feed_calendar
    with self.zip_archive.open(caltxt, "r") as file:
  File "D:\OSGeo4W\apps\Python39\lib\zipfile.py", line 1502, in open
    zinfo = self.getinfo(name)
  File "D:\OSGeo4W\apps\Python39\lib\zipfile.py", line 1429, in getinfo
    raise KeyError(
KeyError: "There is no item named 'calendar.txt' in the archive"

@r-akemii
Copy link
Collaborator

Hey @Art-Ev, when AequilibraE's GTFS module was added, the calendar.txt file was a mandatory requirement. It has to be updated to include either calendar.txt or calendar_dates.txt as in Toulouse GTFS. I'll add a bug tag to the issue to update GTFS-required files in the importer.

@r-akemii r-akemii added the bug Something isn't working label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants