2

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

Mohamed Amine
  • 340
  • 1
  • 4
  • 16
  • 1
    As far as I know, `urllib` hasn't had `quote` as a direct member since Python 2. In Python 3, it's `urllib.parse.quote`. Are you sure the package that contains that import is compatible with the version of Python you're using? – Brian61354270 Apr 05 '21 at 15:14
  • Does this answer your question? [Python: Importing urllib.quote](https://stackoverflow.com/questions/31827012/python-importing-urllib-quote) – Jacob Lee Apr 05 '21 at 15:17
  • unfortunately no the parselmouth module imports the urllib package that way and i cannot change it – Mohamed Amine Apr 05 '21 at 15:19

2 Answers2

13

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

Mei-me-i
  • 146
  • 3
3

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
Jacob Lee
  • 4,405
  • 2
  • 16
  • 37