diff --git a/openstates/me/legislators.py b/openstates/me/legislators.py index 0e4baa8328..de8cc06a87 100644 --- a/openstates/me/legislators.py +++ b/openstates/me/legislators.py @@ -91,7 +91,11 @@ def scrape_reps(self, chamber, term_name): # Try to get color photo from the dems' website. elif party == 'Democratic': xpath = '//a[contains(@href, "housedems")]/@href' - party_website_url = doc.xpath(xpath)[0] + + els = doc.xpath(xpath) + if els: + party_website_url = els[0] + try: party_website_html = self.urlopen(party_website_url) except scrapelib.HTTPError: