Skip to content
Browse files

Handle URLerror

  • Loading branch information...
1 parent fcb97f6 commit 9c523870eb65ff6f6a24548e5c3fb4561b48ede7 François Boulogne committed Aug 21, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 ZimArchivist/archive.py
View
8 ZimArchivist/archive.py
@@ -103,6 +103,7 @@ def run(self):
#Normally OK, but...
#Some links can raise ValueError
print('ValueError Fetchlink ' + str(e))
+ print(current_parsed)
img["src"] = os.path.relpath(outpath, self.htmlpath) # rel path
#end...
self.queue.task_done()
@@ -246,7 +247,12 @@ def make_archive_thread(html_path, uuid, url):
"""
logging.debug('get ' + url)
#Open the url
- soup = bs(urlopen(url))
+ try:
+ soup = bs(urlopen(url))
+ except urllib.error.HTTPError:
+ print('could not open ' + str(url))
+ # raise an error to do not add internal link in zim notes
+ raise URLError
#Parsed url
parsed = list(urlparse.urlparse(url))

0 comments on commit 9c52387

Please sign in to comment.
Something went wrong with that request. Please try again.