Jul-23-2023, 10:26 PM
(This post was last modified: Jul-23-2023, 10:26 PM by rjdegraff42.)
I don't know if it's just me having a "senior" moment, but when I run the following code in idle
Windows 11 Home.
AttributeError: module 'urllib' has no attribute 'parse'
FYI I have ten different folders all named urllib. Everything that wants to use Python seems to install its own copy and I have no way of knowing what gets used when I run a script inside, or outside idle.
import urllib
print(urllib.parse.quote('my file.txt'))I get the outputmy%20file.txtbut when I run the same code from the command line I get
Traceback (most recent call last):
File "D:\temp\test.py", line 3, in <module>
print(urllib.parse.quote('my file.txt'))
AttributeError: module 'urllib' has no attribute 'parse'the following (from the command line) seems to show that parse is indeed part of the package>>> help(urllib)
Help on package urllib:
NAME
urllib
MODULE REFERENCE
https://docs.python.org/3.10/library/urllib.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
PACKAGE CONTENTS
error
parse
request
response
robotparser
FILE
c:\python\lib\urllib\__init__.pyI'm running Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32Windows 11 Home.
AttributeError: module 'urllib' has no attribute 'parse'
FYI I have ten different folders all named urllib. Everything that wants to use Python seems to install its own copy and I have no way of knowing what gets used when I run a script inside, or outside idle.
