You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When importing a feed with a calendar_dates.txt (The "TriMet Style") with the management command, the import fails with a nasty error when it tries to rename the feed at the very end. The rest of the import seems to work flawlessly.
When providing a name via the -n switch, the name generation is skipped and the error is avoided.
It appears that the Service objects are being created, but with Service.start_date and Service.end_date both nulled. When the importer gets to this part
the service exists, but service.start_date is None which causes the strftime to puke out this error:
INFO - Import completed in 2512.7 seconds.
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/mharvey/Envs/portal-rewrite/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/Users/mharvey/Envs/portal-rewrite/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/mharvey/Envs/portal-rewrite/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/mharvey/Envs/portal-rewrite/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/Users/mharvey/Envs/portal-rewrite/lib/python3.6/site-packages/multigtfs/management/commands/importgtfs.py", line 92, in handle
name += service.start_date.strftime(' starting %Y-%m-%d')
AttributeError: 'NoneType' object has no attribute 'strftime'
I think the better behavior would be to check for an existing FeedInfo and use the start/end dates from that, then fall back to Service, and if the start_date is None or the Service doesn't exist, then finally fall back to the default name with the date on which the feed was imported.
The text was updated successfully, but these errors were encountered:
I'd rather not make auto-naming any more complex than it already is, but that's probably the right thing for these horrible feeds. It may make sense to move this to a suggest_name function on the Feed model, so that we can get it under unit tests and code coverage, rather than import a whole feed to test it.
When importing a feed with a
calendar_dates.txt
(The "TriMet Style") with the management command, the import fails with a nasty error when it tries to rename the feed at the very end. The rest of the import seems to work flawlessly.When providing a name via the
-n
switch, the name generation is skipped and the error is avoided.It appears that the
Service
objects are being created, but withService.start_date
andService.end_date
both nulled. When the importer gets to this partdjango-multi-gtfs/multigtfs/management/commands/importgtfs.py
Lines 84 to 92 in f104c09
the
service
exists, butservice.start_date
isNone
which causes thestrftime
to puke out this error:I think the better behavior would be to check for an existing
FeedInfo
and use the start/end dates from that, then fall back toService
, and if thestart_date
isNone
or theService
doesn't exist, then finally fall back to the default name with the date on which the feed was imported.The text was updated successfully, but these errors were encountered: