{"action":"created","issue":{"url":"https://api.github.com/repos/jaraco/keyring/issues/142","labels_url":"https://api.github.com/repos/jaraco/keyring/issues/142/labels{/name}","comments_url":"https://api.github.com/repos/jaraco/keyring/issues/142/comments","events_url":"https://api.github.com/repos/jaraco/keyring/issues/142/events","html_url":"https://github.com/jaraco/keyring/issues/142","id":58653737,"number":142,"title":"Check for Windows backend not necessary on OS X (and otherwise)","user":{"login":"jaraco","id":308610,"avatar_url":"https://avatars.githubusercontent.com/u/308610?v=3","gravatar_id":"","url":"https://api.github.com/users/jaraco","html_url":"https://github.com/jaraco","followers_url":"https://api.github.com/users/jaraco/followers","following_url":"https://api.github.com/users/jaraco/following{/other_user}","gists_url":"https://api.github.com/users/jaraco/gists{/gist_id}","starred_url":"https://api.github.com/users/jaraco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaraco/subscriptions","organizations_url":"https://api.github.com/users/jaraco/orgs","repos_url":"https://api.github.com/users/jaraco/repos","events_url":"https://api.github.com/users/jaraco/events{/privacy}","received_events_url":"https://api.github.com/users/jaraco/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-23T21:43:39Z","updated_at":"2015-02-23T21:43:41Z","closed_at":null,"body":"Hi,\nI added keyring as directory to my project, not via easy_install/pip, to make sure it is available on the target system. When I run it on OS X I get this:\n\n```\nw73mc-imac:Nagstamon hw5$ ./nagstamon.py \nTraceback (most recent call last):\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/Config.py\", line 39, in <module>\n    import Nagstamon.keyring as keyring\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/__init__.py\", line 12, in <module>\n    from .core import (set_keyring, get_keyring, set_password, get_password,\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/core.py\", line 180, in <module>\n    init_backend()\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/core.py\", line 59, in init_backend\n    set_keyring(load_config() or _get_best_keyring())\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/core.py\", line 67, in _get_best_keyring\n    keyrings = backend.get_all_keyring()\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/util/__init__.py\", line 24, in wrapper\n    func.always_returns = func(*args, **kwargs)\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/backend.py\", line 137, in get_all_keyring\n    _load_backends()\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/backend.py\", line 129, in _load_backends\n    list(map(_load_backend, backends))\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/backend.py\", line 114, in _load_backend\n    mod = importlib.import_module('.'+name, package)\n  File \"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py\", line 37, in import_module\n    __import__(name)\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/backends/Windows.py\", line 11, in <module>\n    from . import _win_crypto\n  File \"/Users/hw5/Desktop/Nagstamon/master/Nagstamon/Nagstamon/keyring/backends/_win_crypto.py\", line 4, in <module>\n    from ctypes import windll, WinDLL, WINFUNCTYPE\nImportError: cannot import name windll\n```\n\nApparently start fails because windll, WinDLL and WINFUNCTYPE cannot be imported via ctypes. They are not necessary on OS X anyways.\nIf I change _load_backends() from keyring/backends to:\n\n```python3\ndef _load_backends():\n    \"ensure that all keyring backends are loaded\"\n    backends = ('file', 'Gnome', 'Google', 'keyczar', 'kwallet', 'multi',\n        'OS_X', 'pyfs', 'SecretService')\n    list(map(_load_backend, backends))\n```\n\nomitting the 'Windows'-backend it runs. Couldn't here be a simple check which OS runs and use only the needed or possible backends? Windows itself would not need no Gnome and OS_X, for example.\n\nBest regards and thanks for a great project\nHenri\n\n----------------------------------------\n- Bitbucket: https://bitbucket.org/kang/python-keyring-lib/issue/142\n- Originally reported by: Anonymous\n- Originally created at: 2014-04-07T16:08:26.726\n"},"comment":{"url":"https://api.github.com/repos/jaraco/keyring/issues/comments/75641585","html_url":"https://github.com/jaraco/keyring/issues/142#issuecomment-75641585","issue_url":"https://api.github.com/repos/jaraco/keyring/issues/142","id":75641585,"user":{"login":"jaraco","id":308610,"avatar_url":"https://avatars.githubusercontent.com/u/308610?v=3","gravatar_id":"","url":"https://api.github.com/users/jaraco","html_url":"https://github.com/jaraco","followers_url":"https://api.github.com/users/jaraco/followers","following_url":"https://api.github.com/users/jaraco/following{/other_user}","gists_url":"https://api.github.com/users/jaraco/gists{/gist_id}","starred_url":"https://api.github.com/users/jaraco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaraco/subscriptions","organizations_url":"https://api.github.com/users/jaraco/orgs","repos_url":"https://api.github.com/users/jaraco/repos","events_url":"https://api.github.com/users/jaraco/events{/privacy}","received_events_url":"https://api.github.com/users/jaraco/received_events","type":"User","site_admin":false},"created_at":"2015-02-23T21:43:41Z","updated_at":"2015-02-23T21:43:41Z","body":"I believe the ImportError as reported is no longer an issue. Looking at the latest code, the import of _win_crypto is wrapped in a try/except block for ImportError. I suspect you're running an old version of keyring. Can you try again with 2.0 or later and confirm the issue is no longer present?\n\n----------------------------------------\nOriginal comment by: Jason R. Coombs\n"}}