Sadless74 / googletransitdatafeed

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

AttributeError: 'NoneType' object has no attribute 'strip' #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
------------------------------------------------------------
File "C:\GTFSFeedValidator\TRANSI~1.4\feedvalidator.py", line 275, in main
       loader = transitfeed.Loader(feed, problems=problems, 
extra_validation=True)
 -->   schedule = loader.Load()

    feed = V:\TechSvc\GoogleTransit\Publications\20080601
    parser = <optparse.OptionParser instance at 0x00BD5A58>
    manual_entry = False
    args = ['V:\\TechSvc\\GoogleTransit\\Publications\\20080601']
    problems = <__main__.HTMLCountingProblemReporter instance at 
0x00BDF7D8>
    loader = <transitfeed.Loader instance at 0x00BDF968>
    options = {'output': 'validation-results.html', 'manual_entry': False}

File "C:\GTFSFeedValidator\TRANSI~1.4\transitfeed.py", line 2755, in Load
         self._LoadStops()
 -->     self._LoadRoutes()
         self._LoadCalendar()
    self = <transitfeed.Loader instance at 0x00BDF968>

File "C:\GTFSFeedValidator\TRANSI~1.4\transitfeed.py", line 2514, in 
_LoadRoutes
           route = Route(field_list=row)
 -->       self._schedule.AddRouteObject(route, self._problems)

    self = <transitfeed.Loader instance at 0x00BDF968>
    route = {'route_long_name': None, 'route_type': 3, 'route_text_color': 
None, 'route_color': None, 'agency_id': u'1', 'route_id':
 u'1', 'route_url': None, 'route_desc': u'A-Antioch 
Downtown', 'route_short_name': u'A'}
    row_num = 2
    cols = 
['route_id', 'route_short_name', 'route_long_name', 'route_type', 'agency_i
d', 'route_desc', 'route_url', 'route_color',
'route_text_color']
    row = [u'1', u'A', None, u'3', u'1', u'A-Antioch Downtown', None, 
None, None]

File "C:\GTFSFeedValidator\TRANSI~1.4\transitfeed.py", line 1944, in 
AddRouteObject

 -->     route.Validate(problem_reporter)

    route = {'route_long_name': None, 'route_type': 3, 'route_text_color': 
None, 'route_color': None, 'agency_id': u'1', 'route_id':
 u'1', 'route_url': None, 'route_desc': u'A-Antioch 
Downtown', 'route_short_name': u'A'}
    self = <transitfeed.Schedule instance at 0x00BDFA80>
    problem_reporter = <__main__.HTMLCountingProblemReporter instance at 
0x00BDF7D8>

File "C:\GTFSFeedValidator\TRANSI~1.4\transitfeed.py", line 636, in 
Validate
         if (self.route_short_name and
 -->         (self.route_long_name.strip().lower().startswith(
                 self.route_short_name.strip().lower() + ' ') or
    self = {'route_long_name': None, 'route_type': 3, 'route_text_color': 
None, 'route_color': None, 'agency_id': u'1', 'route_id':
u'1', 'route_url': None, 'route_desc': u'A-Antioch 
Downtown', 'route_short_name': u'A'}
    problems = <__main__.HTMLCountingProblemReporter instance at 
0x00BDF7D8>

AttributeError: 'NoneType' object has no attribute 'strip'

------------------------------------------------------------

Original issue reported on code.google.com by greg.god...@jocogov.org on 20 Jun 2008 at 7:11

GoogleCodeExporter commented 9 years ago
It looks like I have a problem with my routes.txt file, but I can't seem to 
identify 
what it is.
Thanks.

Original comment by greg.god...@jocogov.org on 20 Jun 2008 at 8:05

GoogleCodeExporter commented 9 years ago
Thanks for the report. I'm pretty sure you can work around this problem by 
adding a
route_long_name column to routes.txt (even if the value for it is the empty 
string on
every row). I am writing a fix which will get into the next release. Let me 
know if
the work around helps.

Original comment by tom.brow...@gmail.com on 28 Jun 2008 at 2:17

GoogleCodeExporter commented 9 years ago
Also, utf-8 errors in route_long_name can trigger this bug.

Original comment by tom.brow...@gmail.com on 30 Jun 2008 at 6:57

GoogleCodeExporter commented 9 years ago
It looks like the error may have been due to the UTF version of the files.

My DB extract (SQL Server 2005 & Win XP client) was creating UTF-16 files.  I 
was 
looking for a conversion tool when I discovered that COPY with the "a" switch 
(a as 
in ASCII), generates a file that passes as UTF-8. 

Thanks,

Original comment by greg.god...@jocogov.org on 30 Jun 2008 at 9:52

GoogleCodeExporter commented 9 years ago
The validator should read UTF-16, generate an error and otherwise process it
normally. If you send me the file I can work out what went wrong with the utf-16
handling.

Original comment by tom.brow...@gmail.com on 30 Jun 2008 at 9:56

GoogleCodeExporter commented 9 years ago
No bother.  We're good now.  I am getting good validation now, and I'm not sure 
we 
could reproduce the files that caused the error message.
Thanks!

Original comment by greg.god...@jocogov.org on 30 Jun 2008 at 10:06

GoogleCodeExporter commented 9 years ago
Fix for route_long_name = None (stack trace that opened this issue) is fixed in 
trunk
and will be in next release. If someone reproduces the utf16 problem please 
open a
new issue.

Original comment by tom.brow...@gmail.com on 30 Jun 2008 at 10:46

GoogleCodeExporter commented 9 years ago

Original comment by bdfer...@google.com on 26 Sep 2014 at 4:35