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

Import module and string formatting error #411

Closed
paulsbond opened this issue Dec 2, 2019 · 3 comments
Closed

Import module and string formatting error #411

paulsbond opened this issue Dec 2, 2019 · 3 comments

Comments

@paulsbond
Copy link

paulsbond commented Dec 2, 2019

Describe the bug
When using pip I see the a keyring error before anything happens, e.g.

$ python3 -m pip list | grep keyring
Keyring is skipped due to an exception: not all arguments converted during string formatting
keyring               19.3.0              
keyrings.alt          3.0

The error disappears if I remove the keyring package.
Using keyring gives more details of the error:

$ keyring --list-backends
Traceback (most recent call last):
  File "/home/paul/.local/lib/python3.6/site-packages/keyring/backend.py", line 203, in _load_plugins
    init_func = ep.load()
  File "/home/paul/.local/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 92, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
    from . import file_base
  File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/paul/.local/bin/keyring", line 5, in <module>
    from keyring.cli import main
  File "/home/paul/.local/lib/python3.6/site-packages/keyring/__init__.py", line 1, in <module>
    from .core import (
  File "/home/paul/.local/lib/python3.6/site-packages/keyring/core.py", line 192, in <module>
    init_backend()
  File "/home/paul/.local/lib/python3.6/site-packages/keyring/core.py", line 96, in init_backend
    filter(limit, backend.get_all_keyring()),
  File "/home/paul/.local/lib/python3.6/site-packages/keyring/util/__init__.py", line 22, in wrapper
    func.always_returns = func(*args, **kwargs)
  File "/home/paul/.local/lib/python3.6/site-packages/keyring/backend.py", line 216, in get_all_keyring
    _load_plugins()
  File "/home/paul/.local/lib/python3.6/site-packages/keyring/backend.py", line 207, in _load_plugins
    log.exception("Error initializing plugin %s." % ep)
TypeError: not all arguments converted during string formatting

Environment

  • Python 3.6.9
  • OS: Ubuntu 18.04
@jaraco
Copy link
Owner

jaraco commented Dec 4, 2019

The error about No module named 'keyring.util.escape' was fixed in keyrings.alt 3.1, so you either need to upgrade keyrings.alt to 3.1 or later or downgrade keyring to a version that still supplies the util.escape behavior. I'm less sure about what the TypeError is about, but I suspect it has something to do with the fact that the ep didn't load properly.

@jyn514
Copy link
Contributor

jyn514 commented Dec 12, 2019

I had this error because of a globally installed keyrings.alt package. Running sudo apt autoremove python3-keyrings.alt fixed the issue.

@paulsbond
Copy link
Author

Upgrading keyrings.alt fixed the issue for me:

$ python3 -m pip install --user --upgrade keyrings.alt
$ python3 -m pip list | grep keyring
keyring               19.3.0             
keyrings.alt          3.4.0
$ keyring --list-backends
keyrings.alt.file.EncryptedKeyring (priority: 0.6)
keyring.backends.SecretService.Keyring (priority: 5)
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.chainer.ChainerBackend (priority: 10)
keyrings.alt.file.PlaintextKeyring (priority: 0.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants