python-duckduckgo icon indicating copy to clipboard operation
python-duckduckgo copied to clipboard

No module named "urllib2"

Open Cafeei opened this issue 6 years ago • 5 comments

Cafeei avatar Feb 26 '19 17:02 Cafeei

oof https://pypi.python.org/pypi/DuckDuckGo-Python3-Library/1.0

Cafeei avatar Feb 26 '19 17:02 Cafeei

havn't tried it out but apparently i encounted this issue in a fork repo. Seems like it is caused by not using python 3.5 it's quite outdated tbh.

madonuko avatar Aug 13 '20 12:08 madonuko

i know i am super late but idk why it hasn't been fixed. here's pip install output:

❯ sudo pip install duckduckgo
Collecting duckduckgo
  Downloading duckduckgo-0.1.tar.gz (2.9 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hg8os7ko/duckduckgo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hg8os7ko/duckduckgo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-y3g525o5
         cwd: /tmp/pip-install-hg8os7ko/duckduckgo/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-hg8os7ko/duckduckgo/setup.py", line 2, in <module>
        from duckduckgo import __version__
      File "/tmp/pip-install-hg8os7ko/duckduckgo/duckduckgo.py", line 2, in <module>
        import urllib2
    ModuleNotFoundError: No module named 'urllib2'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

madonuko avatar Aug 13 '20 12:08 madonuko

fixed by installing package duckduckgo3 instead.

madonuko avatar Aug 13 '20 12:08 madonuko

if you have this error or an error with the package urllib2, i found a solution: in the "duckduckgo.py" file, replace this line:

import urllib2

by this line:

import urllib.request as urllib2

this worked for me !

HGStyle avatar Jan 18 '23 12:01 HGStyle