Repository: openstates/openstates-scrapers

Issue:
MA failing since at least 2018-02-23
MA has been failing since 2018-02-23

Based on automated runs it appears that MA has not run successfully in 7 days (2018-02-23).


```
  Syntax Error (220): Illegal character <72> in hex string
Syntax Error (221): Illegal character <73> in hex string
Syntax Error (223): Illegal character <74> in hex string
Syntax Error (224): Illegal character <3d> in hex string
Syntax Error (225): Illegal character <69> in hex string
Syntax Error (226): Illegal character <73> in hex string
Syntax Error (227): Illegal character <6f> in hex string
Syntax Error (228): Illegal character <2d> in hex string
Syntax Error (233): Illegal character <2d> in hex string
Syntax Error (235): Illegal character <22> in hex string
Syntax Error (236): Illegal character <2f> in hex string
Syntax Error (241): Illegal character <74> in hex string
Syntax Error (242): Illegal character <69> in hex string
Syntax Error (243): Illegal character <74> in hex string
Syntax Error (244): Illegal character <6c> in hex string
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table
00:44:41 INFO pupa: No vote found in supplement for vote #310
00:44:41 INFO pupa: save bill H4116 in 190th as bill_0464a268-1d1c-11e8-b0b8-0a58a9feac2a.json
00:44:44 INFO pupa: GET (with `requests`) - https://malegislature.gov/Bills/190/H4232
loaded Open States pupa settings...
ma (scrape, import)
  committees: {}
  people: {}
  bills: {}
Traceback (most recent call last):
  File "/opt/openstates/venv-pupa//bin/pupa", line 11, in <module>
    load_entry_point('pupa', 'console_scripts', 'pupa')()
  File "/opt/openstates/venv-pupa/src/pupa/pupa/cli/__main__.py", line 68, in main
    subcommands[args.subcommand].handle(args, other)
  File "/opt/openstates/venv-pupa/src/pupa/pupa/cli/commands/update.py", line 260, in handle
    return self.do_handle(args, other, juris)
  File "/opt/openstates/venv-pupa/src/pupa/pupa/cli/commands/update.py", line 305, in do_handle
    report['scrape'] = self.do_scrape(juris, args, scrapers)
  File "/opt/openstates/venv-pupa/src/pupa/pupa/cli/commands/update.py", line 173, in do_scrape
    report[scraper_name] = scraper.do_scrape(**scrape_args)
  File "/opt/openstates/venv-pupa/src/pupa/pupa/scrape/base.py", line 111, in do_scrape
    for obj in self.scrape(**kwargs) or []:
  File "/opt/openstates/openstates/openstates/ma/bills.py", line 47, in scrape
    yield from self.scrape_chamber('lower', session)
  File "/opt/openstates/openstates/openstates/ma/bills.py", line 66, in scrape_chamber
    yield from self.scrape_bill(session, bill, chamber)
  File "/opt/openstates/openstates/openstates/ma/bills.py", line 168, in scrape_bill
    self.scrape_actions(bill, bill_url, session)
  File "/opt/openstates/openstates/openstates/ma/bills.py", line 198, in scrape_actions
    self.scrape_action_page(bill, page)
  File "/opt/openstates/openstates/openstates/ma/bills.py", line 231, in scrape_action_page
    y = int(action_name.strip().split(' -')[1].split('YEAS')[0])
IndexError: list index out of range
```

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



Discussion:

Resolving patch:
diff --git a/openstates/ma/bills.py b/openstates/ma/bills.py
--- a/openstates/ma/bills.py
+++ b/openstates/ma/bills.py
@@ -227,8 +227,9 @@ def scrape_action_page(self, bill, page):
             # House votes
             if "Supplement" in action_name:
                 actor = "lower"
-                vote_action = action_name.split(' -')[0]
-                y = int(action_name.strip().split(' -')[1].split('YEAS')[0])
+                action_name_content = re.split(r'\s*-\s*', action_name.strip())
+                vote_action = action_name_content[0]
+                y = int(action_name_content[1].split('YEAS')[0])
                 n = int(action_name.strip().split('YEAS to')[1].split('NAYS')[0])
 
                 # get supplement number


Test patch: