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

ImportError: No module named gi.repository #8

Closed
janssen opened this issue Oct 20, 2016 · 6 comments
Closed

ImportError: No module named gi.repository #8

janssen opened this issue Oct 20, 2016 · 6 comments

Comments

@janssen
Copy link

janssen commented Oct 20, 2016

I'm seeing this failure:

  File "build/bdist.linux-x86_64/egg/secretstorage/collection.py", line 158, in get_default_collection
  File "build/bdist.linux-x86_64/egg/secretstorage/collection.py", line 137, in create_collection
  File "build/bdist.linux-x86_64/egg/secretstorage/util.py", line 127, in exec_prompt_glib
ImportError: No module named gi.repository

Apparently there is also a dependency on some module 'gi'?

@mitya57
Copy link
Owner

mitya57 commented Oct 20, 2016

Right, if you want to use the synchronous API, you need to install the Python GI bindings (aka PyGObject).

They cannot be installed from PyPI, but they are available in e.g. python3-gi package on Debian/Ubuntu.

@janssen
Copy link
Author

janssen commented Oct 20, 2016

Unfortunately, I need secretstorage for a venv, that doesn't use the system Python, and I don't see any easy way to install the bindings there. How about catching the ImportError and just prompting using Python's "input" (or "raw_input" on Python 2) if that happens?

@mitya57
Copy link
Owner

mitya57 commented Oct 20, 2016

What is your use case? One of the key points of Secret Service is its integration with the desktop environments, so input will simply make no sense here (and it's also not available in GUI applications).

If you need some simple API to store passwords in a command-line application, I think you should use something like python-keyring instead, which has, among others, an encrypted file backend.

If you really need desktop integration and want to use it from virtualenv, you can build PyGObject yourself from the source code.

Finally, you can install PyQt5 from PyPI and use it instead of PyGObject to implement the main loop. In this case you will need to use exec_prompt_qt function of SecretStorage (or your own callback).

@janssen
Copy link
Author

janssen commented Oct 20, 2016

I'm running a command-line program that uses Python keyring to store secrets which allow it to communicate with a Web service (basically, a secure cookie, via keyringcookiejar). We want to use the user's login store for this, not an extra encrypted file that has to be locked and unlocked each time. We want this to work the same way it does on the Mac, where the keyring backend talks to the login keychain of the user. Prompting for the password using "raw_input" would work well for this.

@janssen
Copy link
Author

janssen commented Oct 20, 2016

What I'd really like is some option in secretstorage which would allow the user to select what method to use to get information from the user via a prompt.

@mitya57
Copy link
Owner

mitya57 commented Oct 20, 2016

The prompting is done not by SecretStorage. It is just a wrapper around the D-Bus API, the actual prompting is done by the server side (i.e. gnome-keyring). We have no control over this.

See the specification for details.

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

2 participants