Repository: openstates/openstates-scrapers

Issue:
MD failing since at least 2018-04-05
MD has been failing since 2018-04-05

Based on automated runs it appears that MD has not run successfully in 7 days (2018-04-05).


```
  23:58:11 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB743&stab=03&pid=billpage&tab=subject3&ys=2018rs
23:58:12 INFO scrapelib: GET - http://mgaleg.maryland.gov/2018RS/votes/Senate/0995.pdf
23:58:13 INFO pupa: save vote_event 2018 - 2018-03-30 - On Third Reading as vote_event_f065b326-3d44-11e8-8971-02101f904e16.json
23:58:13 INFO pupa: save bill SB743 in 2018 as bill_eeada3fe-3d44-11e8-8971-02101f904e16.json
23:58:13 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB744&stab=01&pid=billpage&tab=subject3&ys=2018rs
23:58:14 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB744&stab=02&pid=billpage&tab=subject3&ys=2018rs
23:58:15 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB744&stab=03&pid=billpage&tab=subject3&ys=2018rs
23:58:16 INFO pupa: save bill SB744 in 2018 as bill_f10333c6-3d44-11e8-8971-02101f904e16.json
23:58:16 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB745&stab=01&pid=billpage&tab=subject3&ys=2018rs
23:58:17 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB745&stab=02&pid=billpage&tab=subject3&ys=2018rs
23:58:18 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB745&stab=03&pid=billpage&tab=subject3&ys=2018rs
23:58:19 INFO pupa: save bill SB745 in 2018 as bill_f2cdc842-3d44-11e8-8971-02101f904e16.json
23:58:19 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB746&stab=01&pid=billpage&tab=subject3&ys=2018rs
23:58:20 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB746&stab=02&pid=billpage&tab=subject3&ys=2018rs
23:58:21 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB746&stab=03&pid=billpage&tab=subject3&ys=2018rs
23:58:22 INFO pupa: save bill SB746 in 2018 as bill_f49758aa-3d44-11e8-8971-02101f904e16.json
23:58:22 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB747&stab=01&pid=billpage&tab=subject3&ys=2018rs
23:58:23 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB747&stab=02&pid=billpage&tab=subject3&ys=2018rs
23:58:24 INFO scrapelib: GET - http://mgaleg.maryland.gov/webmga/frmMain.aspx?id=SB747&stab=03&pid=billpage&tab=subject3&ys=2018rs
23:58:25 INFO scrapelib: GET - http://mgaleg.maryland.gov/2018RS/votes/Senate/0591.pdf
23:58:26 ERROR pupa: Motion Extracted: Wildlife Management - Shooting at Nighttime
loaded Open States pupa settings...
md (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/md/bills.py", line 548, in scrape
    yield from self.scrape_chamber(chamber, session)
  File "/opt/openstates/openstates/openstates/md/bills.py", line 577, in scrape_chamber
    yield from self.scrape_bill(chamber, session, bill_id, url)
  File "/opt/openstates/openstates/openstates/md/bills.py", line 455, in scrape_bill
    yield from self.parse_bill_votes_new(doc, bill)
  File "/opt/openstates/openstates/openstates/md/bills.py", line 180, in parse_bill_votes_new
    vote = self.parse_vote_pdf(href, bill)
  File "/opt/openstates/openstates/openstates/md/bills.py", line 242, in parse_vote_pdf
    raise ValueError("No Motion or faulty Motion scraped.")
ValueError: No Motion or faulty Motion scraped.
```

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



Discussion:
About to push a PR, patching this one. This is the  first case with empty motion.
wanted to double check on progress on this or I'll take it on
Really sorry for the delay, my system crashed few days ago, will surely work on this and others today.

Resolving patch:
diff --git a/openstates/md/bills.py b/openstates/md/bills.py
--- a/openstates/md/bills.py
+++ b/openstates/md/bills.py
@@ -229,7 +229,7 @@ def parse_vote_pdf(self, vote_url, bill):
             assert consent_calendar_bills, "Could not find bills for consent calendar vote"
 
         motion_keywords = ['favorable', 'reading', 'amendment', 'motion', 'introduced',
-                           'bill pass']
+                           'bill pass', 'committee']
         motion_lines = [3, 2, 4, 5]  # Relative LineNumbers to be checked for existence of motion
 
         for i in motion_lines:
@@ -238,8 +238,12 @@ def parse_vote_pdf(self, vote_url, bill):
             motion = re.split(r'\s{2,}', lines[page_index-i].strip())[0]
         else:
             if not any(motion_keyword in motion.lower() for motion_keyword in motion_keywords):
-                self.error("Motion Extracted: %s" % motion)
-                raise ValueError("No Motion or faulty Motion scraped.")
+                # This condition covers for the bad formating in SB 1260
+                motion = lines[page_index-3]
+            if not any(motion_keyword in motion.lower() for motion_keyword in motion_keywords):
+                # Check this one for SB 747
+                motion = "No motion given"
+                self.warning("No motion given")
 
         vote = VoteEvent(
             bill=bill,


Test patch: