Repository: openstates/openstates-scrapers

Issue:
CO scraper failing since at least 2017-05-10
CO has been failing since 2017-05-10

Based on automated runs it appears that CO has not run successfully in 2 days (2017-05-10).


```
  08:09:20 INFO scrapelib: GET - http://leg.colorado.gov/bills/hb17-1305
08:09:20 INFO scrapelib: GET - http://leg.colorado.gov/content/ssa2017a2017-05-01t133750z-hb17-1305-0-activity-vote-summary
08:09:21 INFO scrapelib: GET - http://leg.colorado.gov/content/happ2017a2017-04-21t081746z-hb17-1305-0-activity-vote-summary
08:09:23 INFO scrapelib: GET - http://leg.colorado.gov/content/hjud2017a2017-04-13t141942z-hb17-1305-0-activity-vote-summary
08:09:24 INFO scrapelib: GET - http://leg.colorado.gov/content/hjud2017a2017-04-13t141942z-hb17-1305-1-activity-vote-summary
08:09:25 INFO scrapelib: GET - http://leg.colorado.gov/content/ssa2017a2017-05-01t133750z-hb17-1305-0-activity-vote-summary
08:09:25 INFO scrapelib: GET - http://leg.colorado.gov/content/happ2017a2017-04-21t081746z2-hearing-summary
08:09:27 INFO scrapelib: GET - http://leg.colorado.gov/content/hjud2017a2017-04-13t141942z4-hearing-summary
08:09:28 INFO billy: Save bill lower 2017A: HB17-1305
08:09:28 INFO scrapelib: GET - http://leg.colorado.gov/bills/hb17-1337
08:09:28 INFO scrapelib: GET - http://leg.colorado.gov/content/sfin2017a2017-05-02t140612z-hb17-1337-0-activity-vote-summary
08:09:29 INFO scrapelib: GET - http://leg.colorado.gov/content/sfin2017a2017-05-02t140612z-hb17-1337-1-activity-vote-summary
08:09:31 INFO scrapelib: GET - http://leg.colorado.gov/content/happ2017a2017-04-21t081746z-hb17-1337-0-activity-vote-summary
08:09:32 INFO scrapelib: GET - http://leg.colorado.gov/content/sfin2017a2017-05-02t140612z5-hearing-summary
08:09:33 INFO scrapelib: GET - http://leg.colorado.gov/content/happ2017a2017-04-21t081746z6-hearing-summary
08:09:34 INFO billy: Save bill lower 2017A: HB17-1337
08:09:34 INFO scrapelib: GET - http://leg.colorado.gov/bills/hb17-1335
08:09:34 INFO scrapelib: GET - http://leg.colorado.gov/content/hbus2017a2017-04-20t133046z-hb17-1335-0-activity-vote-summary
08:09:36 INFO scrapelib: GET - http://leg.colorado.gov/content/hbus2017a2017-04-20t133046z3-hearing-summary
08:09:37 INFO billy: Save bill lower 2017A: HB17-1335
08:09:37 INFO scrapelib: GET - http://leg.colorado.gov/bills/hb17-1365
08:09:37 INFO scrapelib: GET - http://leg.colorado.gov/content/sfin2017a2017-05-05t134230z-hb17-1365-0-activity-vote-summary
08:09:38 INFO scrapelib: GET - http://leg.colorado.gov/content/hbus2017a2017-04-27t133516z-hb17-1365-0-activity-vote-summary
08:09:40 INFO scrapelib: GET - http://leg.colorado.gov/content/hbus2017a2017-04-27t133516z5-hearing-summary
08:09:40 INFO billy: Save bill lower 2017A: HB17-1365
08:09:40 INFO scrapelib: GET - http://leg.colorado.gov/bills/hb17-1124
08:09:41 INFO scrapelib: GET - http://leg.colorado.gov/content/hsa2017a2017-02-22t133140z-hb17-1124-0-activity-vote-summary
08:09:42 INFO scrapelib: GET - http://leg.colorado.gov/content/hsa2017a2017-02-22t133140z-hb17-1124-1-activity-vote-summary
08:09:44 INFO scrapelib: GET - http://leg.colorado.gov/content/hsa2017a2017-02-22t133140z0-hearing-summary
08:09:45 INFO billy: Save bill lower 2017A: HB17-1124
08:09:45 INFO scrapelib: GET - http://leg.colorado.gov/bills/hb17-1293
08:09:45 INFO scrapelib: GET - http://leg.colorado.gov/content/slg2017a2017-05-02t140258z-hb17-1293-0-activity-vote-summary
    self.scrape_bill_list(session, chamber, i)
  File "/usr/local/bin/billy-update", line 9, in <module>
    load_entry_point('billy==1.9.0', 'console_scripts', 'billy-update')()
  File "/opt/openstates/billy/billy/bin/update.py", line 368, in main
    run_record += _run_scraper(stype, args, metadata)
  File "/opt/openstates/billy/billy/bin/update.py", line 102, in _run_scraper
    scraper.scrape(chamber, time)
  File "/srv/openstates-web/openstates/co/bills.py", line 47, in scrape
Traceback (most recent call last):
  File "/srv/openstates-web/openstates/co/bills.py", line 79, in scrape_bill_list
    self.scrape_bill(session, chamber, bill_url)
  File "/srv/openstates-web/openstates/co/bills.py", line 114, in scrape_bill
    self.scrape_votes(bill, page)
  File "/srv/openstates-web/openstates/co/bills.py", line 297, in scrape_votes
    self.scrape_vote(bill, vote_url, chamber, date)
  File "/srv/openstates-web/openstates/co/bills.py", line 302, in scrape_vote
    motion = page.xpath('//td/b/font[text()="MOTION:"]/../../following-sibling::td/font/text()')[0]
IndexError: list index out of range
```

Visit http://bobsled.openstates.org/ for more info.



Discussion:
Nothing wrong with the code. 
`Adopt amendment L.002.`  has broken `Vote Summary` page. 
[Link](http://leg.colorado.gov/bills/hb17-1293)

Updating code so that it will not hit the error.

Resolving patch:
diff --git a/openstates/co/bills.py b/openstates/co/bills.py
--- a/openstates/co/bills.py
+++ b/openstates/co/bills.py
@@ -160,7 +160,7 @@ def scrape_versions(self, bill, page):
                 seen_versions.append(version_url)
 
     def scrape_actions(self, bill, page):
-        chamber_map = {'Senate':'upper', 'House': 'lower', 
+        chamber_map = {'Senate':'upper', 'House': 'lower',
                        'Governor':'executive'}
 
         actions = page.xpath('//div[@id="bill-documents-tabs7"]//table//tbody//tr')
@@ -170,7 +170,7 @@ def scrape_actions(self, bill, page):
             action_date = dt.datetime.strptime(action_date, '%m/%d/%Y')
 
             # If an action has no chamber, it's joint
-            # e.g. http://leg.colorado.gov/bills/sb17-100 
+            # e.g. http://leg.colorado.gov/bills/sb17-100
             if action.xpath('td[2]/text()'):
                 action_chamber = action.xpath('td[2]/text()')[0]
                 action_actor = chamber_map[action_chamber]
@@ -299,7 +299,11 @@ def scrape_votes(self, bill, page):
     def scrape_vote(self, bill, vote_url, chamber, date):
         page = self.lxmlize(vote_url)
 
-        motion = page.xpath('//td/b/font[text()="MOTION:"]/../../following-sibling::td/font/text()')[0]
+        try:
+            motion = page.xpath('//td/b/font[text()="MOTION:"]/../../following-sibling::td/font/text()')[0]
+        except:
+            self.warning("Vote Summary Page Broken ")
+            return
 
         if 'withdrawn' not in motion:
             # Every table row after the one with VOTE in a td/div/b/font


Test patch: