jarondl / pygtfs

A python (2/3) library for GTFS
MIT License
63 stars 44 forks source link

route_type range error from Prague's feed #45

Closed scstraus closed 5 years ago

scstraus commented 6 years ago

Hi, I've been trying to get GTFS working via the homeassistant component which uses pygtfs. I'm trying to use Prague's GTFS feed.

I'm on Python 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin

It doesn't have a lot of options, I just gave it the following parameters:

I also tried the human readable names for the stops and tried to unzip the jrdata and give it the folder name instead.. No dice.. Any ideas where the problem might be?

018-12-03 00:13:09 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform gtfs Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=hass.loop) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/tasks.py", line 416, in wait_for return fut.result() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(self.args, self.kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/homeassistant/components/sensor/gtfs.py", line 180, in setup_platform pygtfs.append_feed(gtfs, os.path.join(gtfs_dir, data)) File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/pygtfs/loader.py", line 89, in append_feed instance = gtfs_class(feed_id=feed_id, records_as_dict) File "", line 4, in init File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/sqlalchemy/orm/state.py", line 424, in _initialize_instance manager.dispatch.init_failure(self, args, kwargs) File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/sqlalchemy/util/langhelpers.py", line 66, in exit compat.reraise(exc_type, exc_value, exc_tb) File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/sqlalchemy/util/compat.py", line 249, in reraise raise value File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/sqlalchemy/orm/state.py", line 421, in _initialize_instance return manager.original_init(mixed[1:], **kwargs) File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/sqlalchemy/ext/declarative/base.py", line 748, in _declarative_constructor setattr(self, k, kwargs[k]) File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/sqlalchemy/orm/attributes.py", line 229, in set instance_dict(instance), value, None) File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/sqlalchemy/orm/attributes.py", line 710, in set value, old, initiator) File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/sqlalchemy/orm/attributes.py", line 717, in fire_replace_event state, value, previous, initiator or self._replacetoken) File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/sqlalchemy/orm/util.py", line 136, in set return validator(state.obj(), key, value) File "/Users/scstraus/.homeassistant/deps/lib/python/site-packages/pygtfs/gtfs_entities.py", line 66, in in_range "{0} must be in range {1}, was {2}".format(key, int_choice, value)) pygtfs.exceptions.PygtfsValidationError: route_type must be in range range(0, 8), was 800

jarondl commented 5 years ago

This was fixed a while ago, but a new version was not released until a couple of weeks ago. Also homeassistant seems to use their own fork of PyGTFS. I've commented about the new release in home-assistant/home-assistant#15725

Let's continue the discussion there, because using the old version is the root cause of this error.

scstraus commented 5 years ago

Cool, thanks. Will do.