replaced get_departures with DataModel in pyside
[pywienerlinien] / gotovienna / realtime.py
index ad43db2..a7ccde2 100644 (file)
@@ -194,8 +194,12 @@ class ITipParser:
         if msg and len(msg) > 0 and unicode(msg[0].text).find(u'technischen St') > 0:
             print '\n'.join(map(lambda x: x.text.replace(' ', ''), msg))
             return []
-
-        lines = bs.find('form', {'name': 'mainform'}).table.findAll('tr')[1]
+        
+        mainform = bs.find('form', {'name': 'mainform'})
+        if not mainform:
+            return []
+        
+        lines = mainform.table.findAll('tr')[1]
 
         if len(lines.findAll('td', {'class': 'info'})) > 0:
             station = lines.span.text.replace(' ', '')