Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python2: Cannot use dnspython resolver without selectors2 #1641

Closed
jamadden opened this issue Jun 10, 2020 · 0 comments
Closed

Python2: Cannot use dnspython resolver without selectors2 #1641

jamadden opened this issue Jun 10, 2020 · 0 comments
Labels
PyVer: python2 Affects Python 2 Type: Bug Identified as a bug; needs a code change to fix

Comments

@jamadden
Copy link
Member

  • gevent version: 20.6
  • Python version: Any Py2

Because of a bug in the way the patched import is happening.

$ GEVENT_RESOLVER=dnspython python -c 'import gevent.socket; gevent.socket.gethostbyname("google.com")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "//src/gevent/_socketcommon.py", line 181, in gethostbyname
    return get_hub().resolver.gethostbyname(hostname)
  File "//src/gevent/hub.py", line 830, in _get_resolver
    self._resolver = self.resolver_class(hub=self) # pylint:disable=not-callable
  File "//src/gevent/hub.py", line 826, in resolver_class
    return GEVENT_CONFIG.resolver
  File "//src/gevent/_config.py", line 50, in getter
    return self.settings[setting_name].get()
  File "//src/gevent/_config.py", line 146, in get
    self.value = self.validate(self._default())
  File "//src/gevent/_config.py", line 248, in validate
    return self._import_one_of([self.shortname_map.get(x, x) for x in value])
  File "//src/gevent/_config.py", line 223, in _import_one_of
    return self._import_one(candidates[-1])
  File "//src/gevent/_config.py", line 237, in _import_one
    module = importlib.import_module(module)
  File "/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "//src/gevent/resolver/dnspython.py", line 143, in <module>
    dns = _patch_dns()
  File "//src/gevent/resolver/dnspython.py", line 131, in _patch_dns
    patcher = importer('dns', extra_all, after_import_hook)
  File "//src/gevent/_patcher.py", line 187, in import_patched
    patcher = _SysModulesPatcher(module_name, extra_all)
  File "//src/gevent/_patcher.py", line 55, in __init__
    in iteritems(MAPPING)
  File "//src/gevent/_patcher.py", line 54, in <dictcomp>
    for gevent_name, stdlib_name
  File "//lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "//src/gevent/selectors.py", line 23, in <module>
    import selectors2 as __selectors__
ImportError: No module named selectors2
@jamadden jamadden added Type: Bug Identified as a bug; needs a code change to fix PyVer: python2 Affects Python 2 labels Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PyVer: python2 Affects Python 2 Type: Bug Identified as a bug; needs a code change to fix
Projects
None yet
Development

No branches or pull requests

1 participant