ImportError: cannot import name 'quote' from 'urllib' (/usr/lib/python3.7/urllib/__init__.py)

Viewed 4818

i am using praat from parselmouth in gooogle colab and i am getting this error when importing from parselmouth.praat import call

/usr/local/lib/python3.7/dist-packages/parselmouth/adapters/dfp/interface.py in <module>()
     15 from datetime import timedelta
     16 from pytz import timezone
---> 17 from urllib import quote
     18 
     19 # Parselmouth Imports

ImportError: cannot import name 'quote' from 'urllib' (/usr/lib/python3.7/urllib/__init__.py)

i tried installing diffirent version of urllib but nothing worked
i know that urllib uses import urllib.parse.quote instead offrom urllib import quote but i am not the one importing the urllib package it s the praat module and i cannot change it

2 Answers

I had the same problem and I fixed it by running pip uninstall parselmouth, then pip install praat-parselmouth

Some info here

Also see this Github issue

If you look at the urllib documentation, you'll find that the quote() function is part of the urllib.parse module. Thus:

from urllib.parse import quote
Related