Repository: openstates/openstates-scrapers

Issue:
OK failing since at least 2018-04-11
OK has been failing since 2018-04-11

Based on automated runs it appears that OK has not run successfully in 2 days (2018-04-11).


```
  03:05:40 INFO pupa: save membership 49f97e8e-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "party", "name": "Republican"} as membership_49f984e2-3e28-11e8-8409-02a8aab76376.json
03:05:40 INFO scrapelib: GET - http://oksenate.gov/Senators/biographies/dossett_bio.html
03:05:41 WARNING pupa: J.J. Dossett appears to have no district office address; skipping it
03:05:41 INFO pupa: save person J.J. Dossett as person_4a9288e0-3e28-11e8-8409-02a8aab76376.json
03:05:41 INFO pupa: save membership 4a9288e0-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "upper"} as membership_4a928cdc-3e28-11e8-8409-02a8aab76376.json
03:05:41 INFO pupa: save membership 4a9288e0-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "party", "name": "Democratic"} as membership_4a928f3e-3e28-11e8-8409-02a8aab76376.json
03:05:41 INFO scrapelib: GET - http://oksenate.gov/Senators/biographies/dugger_bio.html
03:05:42 INFO pupa: save person Tom Dugger as person_4b2b57fa-3e28-11e8-8409-02a8aab76376.json
03:05:42 INFO pupa: save membership 4b2b57fa-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "upper"} as membership_4b2b5c00-3e28-11e8-8409-02a8aab76376.json
03:05:42 INFO pupa: save membership 4b2b57fa-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "party", "name": "Republican"} as membership_4b2b5e62-3e28-11e8-8409-02a8aab76376.json
03:05:42 INFO scrapelib: GET - http://oksenate.gov/Senators/biographies/fields_bio.html
03:05:43 WARNING pupa: Eddie Fields appears to have no district office address; skipping it
03:05:43 INFO pupa: save person Eddie Fields as person_4bc3e13c-3e28-11e8-8409-02a8aab76376.json
03:05:43 INFO pupa: save membership 4bc3e13c-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "upper"} as membership_4bc3e542-3e28-11e8-8409-02a8aab76376.json
03:05:43 INFO pupa: save membership 4bc3e13c-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "party", "name": "Republican"} as membership_4bc3e7a4-3e28-11e8-8409-02a8aab76376.json
03:05:43 INFO scrapelib: GET - http://oksenate.gov/Senators/biographies/floyd_bio.html
03:05:44 INFO pupa: save person Kay Floyd as person_4c5c0a02-3e28-11e8-8409-02a8aab76376.json
03:05:44 INFO pupa: save membership 4c5c0a02-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "upper"} as membership_4c5c0dfe-3e28-11e8-8409-02a8aab76376.json
03:05:44 INFO pupa: save membership 4c5c0a02-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "party", "name": "Democratic"} as membership_4c5c106a-3e28-11e8-8409-02a8aab76376.json
03:05:44 INFO scrapelib: GET - http://oksenate.gov/Senators/biographies/fry_bio.html
03:05:45 INFO pupa: save person Jack Fry as person_4cf5fcfc-3e28-11e8-8409-02a8aab76376.json
03:05:45 INFO pupa: save membership 4cf5fcfc-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "upper"} as membership_4cf600e4-3e28-11e8-8409-02a8aab76376.json
03:05:45 INFO pupa: save membership 4cf5fcfc-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "party", "name": "Republican"} as membership_4cf6033c-3e28-11e8-8409-02a8aab76376.json
03:05:45 INFO scrapelib: GET - http://oksenate.gov/Senators/biographies/griffin_bio.html
03:05:46 INFO pupa: save person AJ Griffin as person_4d8d9508-3e28-11e8-8409-02a8aab76376.json
03:05:46 INFO pupa: save membership 4d8d9508-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "upper"} as membership_4d8d98fa-3e28-11e8-8409-02a8aab76376.json
03:05:46 INFO pupa: save membership 4d8d9508-3e28-11e8-8409-02a8aab76376 membership in ~{"classification": "party", "name": "Republican"} as membership_4d8d9b84-3e28-11e8-8409-02a8aab76376.json
loaded Open States pupa settings...
ok (scrape, import)
  committees: {}
  bills: {}
  people: {}
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/ok/people.py", line 61, in scrape
    yield from getattr(self, 'scrape_' + chamber + '_chamber')(term)
  File "/opt/openstates/openstates/openstates/ok/people.py", line 201, in scrape_upper_chamber
    name, party = match.group(1), self._parties[match.group(2)]
AttributeError: 'NoneType' object has no attribute 'group'
```

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



Discussion:
grabbing this one.
Will take this today surely.

Resolving patch:
diff --git a/openstates/ok/people.py b/openstates/ok/people.py
--- a/openstates/ok/people.py
+++ b/openstates/ok/people.py
@@ -198,7 +198,12 @@ def scrape_upper_chamber(self, term):
                 continue
             else:
                 match = re.match(r'(.+) \(([A-Z])\)', a.text.strip())
-                name, party = match.group(1), self._parties[match.group(2)]
+                if match:
+                    name, party = match.group(1), self._parties[match.group(2)]
+                else:
+                    self.warning("District {} appears to have empty Representative name,party"
+                                 .format(district))
+                    continue
 
             url = a.get('href')
 


Test patch: