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.

Title: Filename breaks calls to urllib
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Agrim Sachdeva2, eric.smith
Priority: normal Keywords:

Created on 2019-06-11 22:47 by Agrim Sachdeva2, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg345282 - (view) Author: Agrim Sachdeva (Agrim Sachdeva2) Date: 2019-06-11 22:47
If a script that uses urllib is named, the following error occurs:

Traceback (most recent call last):
  File ".\", line 1, in <module>
    import urllib.request, urllib.parse, urllib.error
  File "C:\Users\grim\AppData\Local\Programs\Python\Python37\lib\urllib\", line 88, in <module>
    import http.client
  File "C:\Python\", line 11, in <module>
    html = urllib.request.urlopen(url).read()
AttributeError: module 'urllib' has no attribute 'request'
msg345289 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2019-06-11 23:40
Closing as not a bug. This is how python works: you do not want to name a file the same as any standard library module. Use a file name other than
Date User Action Args
2022-04-11 14:59:16adminsetgithub: 81421
2019-06-11 23:40:47eric.smithsetstatus: open -> closed

type: compile error -> behavior
components: + Library (Lib), - Windows

nosy: + eric.smith, - paul.moore, tim.golden, zach.ware, steve.dower
messages: + msg345289
resolution: not a bug
stage: resolved
2019-06-11 22:47:11Agrim Sachdeva2create