New submission from mike <mikez...@gmail.com>: There's a python program in the attached file http.py, I import urllib.request in http.py, and urllib.request imports http.client.
When I try to run http.py by command "python http.py", the error is as below: Traceback (most recent call last): File "http.py", line 4, in <module> import urllib.request File "C:\Program Files\Python311\lib\urllib\request.py", line 86, in <module> import http.client File "D:\program\python\http.py", line 6, in <module> response = urllib.request.urlopen('http://python.org/') AttributeError: 'module' object has no attribute 'request' However, if I copy http.py to directory PYTHONHOME/Lib and run command "python http.py" under directory PYTHONHOME/Lib, it works successfully; if you move it to other directories and run the command, the error will be returned. Note: the source code of http.py is copied from python311.chm under directory PYTHONHOME/Doc. ---------- components: Library (Lib) files: http.py messages: 93965 nosy: mikezp59 severity: normal status: open title: ImportError of urllib.request & http.client under PYTHONHOME/Lib type: compile error versions: Python 3.1 Added file: http://bugs.python.org/file15121/http.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7121> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com