urllib error URLError urlopen error Errno -2 Name or service not known

0 votes

Hi Guys,

I am trying to browse one URL using the urllib module. But it is showing me the below error.

html = urlopen("https://edureka.co/" + articleUrl)
urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>

How can I solve this error?

Jul 15, 2020 in Python by akhtar
• 38,260 points
5,995 views

1 answer to this question.

0 votes

Hi@akhtar,

You need to use the read function in your command to get the response content. You can use the below command to avoid this error.

html = urlopen("https://edureka.co/" + articleUrl).read()
answered Jul 15, 2020 by MD
• 95,460 points

Related Questions In Python

0 votes
1 answer

Python: Could not install packages due to an OSError: [Errno 2] No such file or directory

I also met with the same problem ...READ MORE

answered Apr 28, 2022 in Python by narikkadan
• 63,600 points
39,178 views
0 votes
1 answer

Python argparse error "NameError: name 'file' is not defined"

The right datatype for destination in argpasrse module ...READ MORE

answered Nov 28, 2018 in Python by Omkar
• 69,220 points
13,707 views
0 votes
3 answers

Python error "NameError: name 'sr' is not defined"

NameError: name 'xx' is not defined Python knows ...READ MORE

answered Mar 19, 2020 in Python by rahul
• 360 points
42,578 views
0 votes
1 answer

How to print a message or the error if a file is not found?

To print the message that file is not ...READ MORE

answered Jan 2, 2019 in Python by Omkar
• 69,220 points
2,868 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,071 views
0 votes
1 answer

Error executing Jupyter command 'notebook': [Errno 2] No such file or directory

Hi@akhtar, I think there is a problem with ...READ MORE

answered Jun 25, 2020 in Python by MD
• 95,460 points
5,440 views
0 votes
1 answer

How to solve the urllib.error.URLError

Hi@Jefferson, You need to use the read function in your ...READ MORE

answered Jul 15, 2020 in Python by MD
• 95,460 points
2,586 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP