From cefe76cf31f5e01f0da6ffdf44c13be55f829efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sz=C3=A9pe=20Viktor?= Date: Sat, 24 May 2014 14:57:51 +0200 Subject: [PATCH] handle undefined href attribute --- html2text.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/html2text.py b/html2text.py index 6e79b43..59fc1e4 100755 --- a/html2text.py +++ b/html2text.py @@ -517,8 +517,9 @@ def handle_tag(self, tag, attrs, start): if tag == "a" and not self.ignore_links: if start: if ('href' in attrs) and \ - not (self.skip_internal_links and - attrs['href'].startswith('#')): + (attrs['href'] is not None) and \ + not (self.skip_internal_links and + attrs['href'].startswith('#')): self.astack.append(attrs) self.maybe_automatic_link = attrs['href'] else: