Sadless74 / googletransitdatafeed

Automatically exported from code.google.com/p/googletransitdatafeed
0 stars 0 forks source link

presence of empty service_period column in trips.txt crashes feed import #190

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. have a trips.txt file with a service_period column specified but no values
2. run any tool, like feedvalidator.py
3.

What is the expected output? What do you see instead?

File
"/home/ehenry/tools/googletransitdatafeed-read-only/python/feedvalidator.py",
line 583, in main
       else:
 -->     return RunValidationOutputToFilename(feed, options, options.output)

    feed = 0923/bus/gtfs/ny_bus.zip
    args = ['0923/bus/gtfs/ny_bus.zip']
    parser = <optparse.OptionParser instance at 0x9516c8>
    options = {'check_duplicate_trips': False, 'manual_entry': True,
'memory_db': False, 'limit_per_type': 5, 'performance': None, 'output':
'validation-results.html'}

File
"/home/ehenry/tools/googletransitdatafeed-read-only/python/feedvalidator.py",
line 475, in RunValidationOutputToFilename
         output_file = open(output_filename, 'w')
 -->     exit_code = RunValidationOutputToFile(feed, options, output_file)
         output_file.close()
    feed = 0923/bus/gtfs/ny_bus.zip
    output_file = <open file 'validation-results.html', mode 'w' at 0xa10f30>
    options = {'check_duplicate_trips': False, 'manual_entry': True,
'memory_db': False, 'limit_per_type': 5, 'performance': None, 'output':
'validation-results.html'}
    output_filename = validation-results.html

File
"/home/ehenry/tools/googletransitdatafeed-read-only/python/feedvalidator.py",
line 491, in RunValidationOutputToFile
       problems = HTMLCountingProblemReporter(options.limit_per_type)
 -->   schedule, exit_code = RunValidation(feed, options, problems)
       if isinstance(feed, basestring):
    feed = 0923/bus/gtfs/ny_bus.zip
    output_file = <open file 'validation-results.html', mode 'w' at 0xa10f30>
    problems = <__main__.HTMLCountingProblemReporter instance at 0x965e18>
    options = {'check_duplicate_trips': False, 'manual_entry': True,
'memory_db': False, 'limit_per_type': 5, 'performance': None, 'output':
'validation-results.html'}

File
"/home/ehenry/tools/googletransitdatafeed-read-only/python/feedvalidator.py",
line 524, in RunValidation
                                   options.check_duplicate_trips)
 -->   schedule = loader.Load()

    feed = 0923/bus/gtfs/ny_bus.zip
    problems = <__main__.HTMLCountingProblemReporter instance at 0x965e18>
    options = {'check_duplicate_trips': False, 'manual_entry': True,
'memory_db': False, 'limit_per_type': 5, 'performance': None, 'output':
'validation-results.html'}
    loader = <transitfeed.Loader instance at 0xa09830>

File
"/home/ehenry/tools/googletransitdatafeed-read-only/python/transitfeed.py",
line 4201, in Load
         self._LoadShapes()
 -->     self._LoadTrips()
         self._LoadHeadways()
    self = <transitfeed.Loader instance at 0xa09830>

File
"/home/ehenry/tools/googletransitdatafeed-read-only/python/transitfeed.py",
line 4075, in _LoadTrips
           trip = Trip(field_dict=d)
 -->       self._schedule.AddTripObject(trip, self._problems)

    row_num = 2
    d = {'service_period': u'', 'block_id': u'10402268', 'route_id':
u'S0078', 'trip_headsign': u'TOTTENVILLE via HYLAN', 'service_id':
u'S0078-11', 'trip_id': u'S0078-11-137'}
    self = <transitfeed.Loader instance at 0xa09830>
    header = ['route_id', 'trip_id', 'block_id', 'service_id',
'trip_headsign', 'service_period']
    trip = <Trip [('block_id', u'10402268'), ('route_id', u'S0078'),
('service_id', u'S0078-11'), ('service_period', u''), ('trip_headsign',
u'TOTTENVILLE via HYLAN'), ('trip_id', u'S0078-11-137')]>
    row = [u'S0078', u'S0078-11-137', u'10402268', u'S0078-11',
u'TOTTENVILLE via HYLAN', u'']

File
"/home/ehenry/tools/googletransitdatafeed-read-only/python/transitfeed.py",
line 3000, in AddTripObject
             problem_reporter = self.problem_reporter
 -->       trip.Validate(problem_reporter, validate_children=False)
         try:
    self = <transitfeed.Schedule instance at 0xa09518>
    validate = True
    trip = <Trip [('block_id', u'10402268'), ('route_id', u'S0078'),
('service_id', u'S0078-11'), ('service_period', u''), ('trip_headsign',
u'TOTTENVILLE via HYLAN'), ('trip_id', u'S0078-11-137')]>
    problem_reporter = <__main__.HTMLCountingProblemReporter instance at
0x965e18>

File
"/home/ehenry/tools/googletransitdatafeed-read-only/python/transitfeed.py",
line 1689, in Validate
           # proceeding with validation. See also comment in Trip.__init__.
 -->       self.service_id = self.__dict__['service_period'].service_id
           del self.service_period
    self = <Trip [('block_id', u'10402268'), ('route_id', u'S0078'),
('service_id', u'S0078-11'), ('service_period', u''), ('trip_headsign',
u'TOTTENVILLE via HYLAN'), ('trip_id', u'S0078-11-137')]>
    problems = <__main__.HTMLCountingProblemReporter instance at 0x965e18>
    validate_children = False

AttributeError: 'unicode' object has no attribute 'service_id'

Please use labels and text to provide additional information.

Original issue reported on code.google.com by ethan.he...@gmail.com on 6 Oct 2009 at 10:45

GoogleCodeExporter commented 9 years ago
Moved to https://github.com/google/transitfeed/issues/190

Original comment by bdfer...@google.com on 8 Oct 2014 at 12:08

GoogleCodeExporter commented 9 years ago

Original comment by bdfer...@google.com on 8 Oct 2014 at 12:15