Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python3 error : AttributeError: module 'urllib' has no attribute 'request'

I am trying to run a script in python3 (tried with 3.7.4 and 3.8.0) which uses urllib.request and urllib.error.

I tried importing in the following ways:

import urllib

and

from urllib import request

but in both the above cases I get error:

AttributeError: module 'urllib' has no attribute 'request'

I haven't installed anything related to urllib as it comes with python3

Please suggest how should this be imported, thanks!

like image 234
OutOfMind Avatar asked Sep 04 '26 18:09

OutOfMind


1 Answers

Worked with following import:

import urllib.request
like image 143
OutOfMind Avatar answered Sep 06 '26 07:09

OutOfMind