samwize / python-email-crawler

Search on Google, and crawls for emails related to the result
293 stars 127 forks source link

SyntaxError: multiple exception types must be parenthesized #34

Open hamzaaitbrik opened 2 years ago

hamzaaitbrik commented 2 years ago

I am getting this error right after I execute the script, here's the try except that generates the error: try: logger.info("Crawling %s" % url) request = urllib2.urlopen(req) except urllib2.URLError, e: logger.error("Exception at url: %s\n%s" % (url, e)) any idea what might be wrong? Thanks.

FaisalAhmed123 commented 1 year ago

image I'm getting the same error too

TT5H commented 8 months ago

image I'm getting the same error too

In Python 3.x, urllib2 has been split into urllib.request and urllib.error. You should replace urllib2 with urllib.request and handle the exceptions using urllib.error