[SOLVED] Python console says urllib.parse doesn't exist - Raspberry Pi Forums


i have not seen before i've tested on windows machine besides rpi (both stock 3.4 , compiled 3.5) sure:
if start python command line , import urllib, urllib.parse.quote("++") returns error saying parse doesn't exist:
python 3.5.1 (default, feb 4 2016, 10:13:12)
[gcc 4.9.2] on linux
type "help", "copyright", "credits" or "license" more information.
>>> import urllib
>>> urllib.parse.quote("++h&")
traceback (most recent call last):
file "<stdin>", line 1, in <module>
attributeerror: module 'urllib' has no attribute 'parse'
if start idle , import urllib in idle's python shell, urllib.parse.quote("++") returns correct result:
python 3.5.1 (default, feb 4 2016, 10:13:12)
[gcc 4.9.2] on linux
type "copyright", "credits" or "license()" more information.
>>> import urllib
>>> urllib.parse.quote("++")
'%2b%2b'
>>>
so, long start python code idle, runs expected. if start command line, reports error.

know caused inconsistency?

it should used way.

code: select all

import urllib.parse urllib.parse.quote("++") '%2b%2b' 
https://docs.python.org/3.5/library/urllib.parse.html


raspberrypi



Comments