A bizarre import
error is preventing me from installing a mercurial extension.
I'm trying to get the mercurial_keyring
extension running so that I don't have to type in my user name and password every time I use mercurial for a project.
I'm using Python 2.7.1. I installed mercurial with the binary provided at https://www.mercurial-scm.org/.
I installed keyring
and mercurial_keyring
with pip
.
I first tried to add the extension by adding this to ~/.hgrc
:
[extensions]
...
mercurial_keyring =
as indicated in the installation instructions here. However, I got the following error:
*** failed to import extension mercurial_keyring: No module named mercurial_keyring
From the same installation instructions, I tried pointing mercurial directly to the mercurial_keyring.py
file, which worked.
[extensions]
...
hgext.mercurial_keyring = /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial_keyring.py
And things seemed to be moving along.
However, when I try to execute any mercurial commands requiring my password so that it will be saved by keyring
(e.g. hg pull
, hg push
) I get the error
abort: No module named keyring!
The most confusing part is that there is a clear
import keyring
in line 28 of mercurial_keyring.py
that is resolved without any problems. In fact, any import keyring
succeeds outside classes and methods and fails inside them!
Just for the sake of thoroughness, I'll mention that this error arises in the mercurial_keyring.py
in the PasswordStore
class in the get_http_password
method when the following is attempted
return keyring.get_password(...)
Any thoughts?
I have the feeling that I'm missing something obvious, but I've spent a good deal of time trying to figure this out and google has not been particularly helpful so far. Any input will be greatly appreciated.