Passwords on OS X via security

Lucien Pullen drurowin at gmail.com
Fri Nov 14 06:32:00 GMT 2014


The `keyring' package is installed with either pip or easy_install.  It
is not distributed with Python.

Also sprach Nicolas Sebrecht on 2014-11-13:
> Now, if you really want to use a shell command instead of pure python
> code you could call your shell command from python with a call like
> Popen(). See
>
>   https://docs.python.org/2/library/subprocess.html
> and
>   https://docs.python.org/2/library/shlex.html#shlex.split
>
> for details.
>
> I would encourage you to try something like that in a python session:
>
>   % python
>   >>> import subprocess
>   >>> import shlex
>   >>> subprocess.Popen(shlex.split('ls /'), stdout=subprocess.PIPE).stdout.read()
>
> which returns a string 'str' as expected in offlineimaprc.
>
> Good luck! ,-)

This will not work, unless I'm trying to use anonymous functions
incorrectly.  Calling "import foo" from a lambda will result in an
error (Python 2.7):

--8<---------------cut here---------------start------------->8---
>>> lambda: import keyring
  File "<stdin>", line 1
    lambda: import keyring
                 ^
SyntaxError: invalid syntax
--8<---------------cut here---------------end--------------->8---

You will need to perform any imports in a .py file.  You mentioned that
an auxiliary file was unwanted, but you may need one.

That or a config option for loading dependent libraries needs to be
added (very specific change for a very specific problem, but that's the
only reason I use a .py file, so maybe an ok one if enough people do
that).




More information about the OfflineIMAP-project mailing list