diff --git a/Lib/htmllib.py b/Lib/htmllib.py
index 73af9f6734c..446192f5513 100644
--- a/Lib/htmllib.py
+++ b/Lib/htmllib.py
@@ -362,10 +362,10 @@ class HTMLParser(SGMLParser):
src = value
if attrname == 'width':
try: width = int(value)
- except: pass
+ except ValueError: pass
if attrname == 'height':
try: height = int(value)
- except: pass
+ except ValueError: pass
self.handle_image(src, alt, ismap, align, width, height)
# --- Really Old Unofficial Deprecated Stuff