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

TypeError when 'shape_dist_traveled' is empty #58

Closed
RuiLoureiro opened this issue Oct 5, 2019 · 1 comment · Fixed by #67
Closed

TypeError when 'shape_dist_traveled' is empty #58

RuiLoureiro opened this issue Oct 5, 2019 · 1 comment · Fixed by #67

Comments

@RuiLoureiro
Copy link

RuiLoureiro commented Oct 5, 2019

When pygtfs tries to parse the following line:

shape_id,shape_pt_lat,shape_pt_lon,shape_pt_sequence,shape_dist_traveled
149554,38.742155,-9.102203,1,

I get the following error:

Failure while writing Shapes(shape_id='149554', shape_pt_lat='38.742155', shape_pt_lon='-9.102203', shape_pt_sequence='1', shape_dist_traveled=None)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-44756ea8a7d9> in <module>
----> 1 pygtfs.append_feed(sched, "data")
...
~/.virtualenvs/thesis/lib/python3.7/site-packages/pygtfs/gtfs_entities.py in is_float_none(self, key, value)
     85     def is_float_none(self, key, value):
     86         try:
---> 87             return float(value)
     88         except ValueError:
     89             if value is None or value == "":

TypeError: float() argument must be a string or a number, not 'NoneType'

Looking at the is_float_none method, it seems you were expecting float(None) to raise a ValueError, but it is raising a TypeError instead.

@olalid
Copy link

olalid commented Feb 19, 2022

Would probably be solved by #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants