Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: multiple exception types must be parenthesized #34

Open
hamzaaitbrik opened this issue Jul 18, 2022 · 2 comments
Open

SyntaxError: multiple exception types must be parenthesized #34

hamzaaitbrik opened this issue Jul 18, 2022 · 2 comments

Comments

@hamzaaitbrik
Copy link

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
Copy link

image
I'm getting the same error too

@TT5H
Copy link

TT5H commented Mar 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants