Pruthvi Raj Pruthvi Raj - 2 years ago 153
Python Question

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

When i run the following code in Python - 3.3:

import urllib
tempfile = urllib.request.urlopen("")

I get the following error:

enter image description here

I did this too to verify:

enter image description here

What am i doing wrong? Thanks in advance!

Answer Source

Import urllib.request instead of urllib.

import urllib.request
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download