This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: not able to find module request in lib urllib - Python35-32
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.5
process
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 2022-04-11 14:58 by admin. 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:

Error: 
Traceback (most recent call last):
  File ".\urllib1.py", line 5, in <module>
    with urllib.request.urlopen('http://www.py4inf.com/code/romeo.txt') as f:
AttributeError: module 'urllib' has no attribute 'request'

Python Code:

import urllib
with urllib.request.urlopen('http://www.py4inf.com/code/romeo.txt') as f:
    print(f.read())
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.
History
Date User Action Args
2022-04-11 14:58:25adminsetgithub: 70168
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