Title: not able to find module request in lib urllib - Python35-32
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.5
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Kiran Kotari, brett.cannon, r.david.murray
Priority: normal Keywords:

Created on 2015-12-30 10:15 by Kiran Kotari, last changed 2015-12-30 17:51 by brett.cannon. This issue is now closed.

Messages (3)
msg257230 - (view) Author: Kiran Kotari (Kiran Kotari) Date: 2015-12-30 10:15
Python 3.5.1 documentation code giving following error:

Traceback (most recent call last):
  File ".\", line 5, in <module>
    with urllib.request.urlopen('') as f:
AttributeError: module 'urllib' has no attribute 'request'

Python Code:

import urllib
with urllib.request.urlopen('') as f:
msg257232 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-12-30 13:56
Can you provide a link to the documentation you find to be in error?
msg257233 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-12-30 17:51
You need to use the line `import urllib.request` to make the import work as you didn't import the urllib.request module, only the urllib package.
Date User Action Args
2015-12-30 17:51:26brett.cannonsetstatus: open -> closed

nosy: + brett.cannon
messages: + msg257233

resolution: not a bug
2015-12-30 13:56:18r.david.murraysetnosy: + r.david.murray
messages: + msg257232
2015-12-30 10:15:37Kiran Kotaricreate