Repository: openstates/openstates-scrapers

Issue:
LA failing since at least 2018-06-06
LA has been failing since 2018-06-06

Based on automated runs it appears that LA has not run successfully in 2 days (2018-06-06).


```
  01:16:34 INFO pupa: save bill HB30 in 2018 2nd Extraordinary Session as bill_53a848de-6a1a-11e8-8cbf-02219983bf54.json
01:16:34 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillInfo.aspx?i=235449
01:16:35 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235449&t=authors
01:16:36 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235449&t=digests
01:16:37 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235449&t=text
01:16:38 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235449&t=amendments
01:16:39 INFO pupa: save bill HB31 in 2018 2nd Extraordinary Session as bill_56a4445c-6a1a-11e8-8cbf-02219983bf54.json
01:16:39 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillInfo.aspx?i=235455
01:16:40 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235455&t=authors
01:16:41 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235455&t=digests
01:16:42 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235455&t=text
01:16:43 INFO pupa: save bill HB32 in 2018 2nd Extraordinary Session as bill_5906edd0-6a1a-11e8-8cbf-02219983bf54.json
01:16:43 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillInfo.aspx?i=235466
01:16:44 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235466&t=authors
01:16:45 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235466&t=digests
01:16:46 INFO scrapelib: GET - http://www.legis.la.gov/Legis/BillDocs.aspx?i=235466&t=text
01:16:47 INFO scrapelib: GET - http://www.legis.la.gov/Legis/ViewDocument.aspx?d=1103263
loaded Open States pupa settings...
la (scrape, import)
  people: {}
  committees: {}
  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/la/bills.py", line 121, in scrape
    bill_abbreviation)
  File "/opt/openstates/openstates/openstates/la/bills.py", line 250, in scrape_bill_page
    amendments = sbp("Amendments")
  File "/opt/openstates/openstates/openstates/la/bills.py", line 235, in sbp
    "//a[contains(text(), '%s')]" % (x))[0].attrib['href'])
  File "/opt/openstates/openstates/openstates/la/bills.py", line 100, in scrape_bare_page
    page = self.lxmlize(url)
  File "/opt/openstates/openstates/openstates/utils/lxmlize.py", line 33, in lxmlize
    page = lxml.html.fromstring(response.text)
  File "/opt/openstates/venv-pupa/lib/python3.6/site-packages/lxml/html/__init__.py", line 876, in fromstring
    doc = document_fromstring(html, parser=parser, base_url=base_url, **kw)
  File "/opt/openstates/venv-pupa/lib/python3.6/site-packages/lxml/html/__init__.py", line 765, in document_fromstring
    "Document is empty")
lxml.etree.ParserError: Document is empty
```

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



Discussion:
looking into this.

Resolving patch:
diff --git a/openstates/la/bills.py b/openstates/la/bills.py
--- a/openstates/la/bills.py
+++ b/openstates/la/bills.py
@@ -97,8 +97,11 @@ def bill_pages(self, url):
                 yield page
 
     def scrape_bare_page(self, url):
-        page = self.lxmlize(url)
-        return page.xpath("//a")
+        try:
+            page = self.lxmlize(url)
+            return page.xpath("//a")
+        except lxml.etree.ParserError:
+            return []
 
     def scrape(self, chamber=None, session=None):
         if not session:


Test patch: