i'm trying to use the "remotepasseval" option to assign passwords in
the offlineimap rc file. I wrote a python function that uses gpg2 to
echo the password. That function is the following:
import re
import subprocess as sb
def bashcmd(command):
p = re.compile(r' ')
sb.call(p.split(command))
and in the rc file i put:
remotepasseval = bashcmd('/usr/bin/gpg2 -dq --no-tty my_pass.gpg')
but offlineimap crashes, below is the output, and note that it prints
in plain text the decoded content of my_pass.gpg
===================================
||
$ offlineimap -c .offlineimaprc/offlineimap.conf -a acc_outlook
||
OfflineIMAP 7.2.0
||
Licensed under the GNU GPL v2 or any later version (with an OpenSSL
exception) ||
imaplib2 v2.57 (bundled), Python v2.7.15, OpenSSL 1.0.2p 14 Aug 2018
||
Account sync acc_outlook:
||
*** Processing account acc_outlook
||
Establishing connection to imap-mail.outlook.com:993 (acc_outlookremote)
||
>>> decoded content of my_pass.gpg is printed here <<<
>>> <=========================
ERROR: While attempting to sync account 'acc_outlook'
'NoneType' object has no attribute 'encode'
*** Finished account 'acc_outlook' in 0:01
ERROR: Exceptions occurred during the run!
ERROR: While attempting to sync account 'acc_outlook'
'NoneType' object has no attribute 'encode'
Traceback:
File "/usr/lib64/python2.7/site-packages/offlineimap/accounts.py", line 283,
in syncrunner
self.__sync()
File "/usr/lib64/python2.7/site-packages/offlineimap/accounts.py", line 359,
in __sync
remoterepos.getfolders()
File "/usr/lib64/python2.7/site-packages/offlineimap/repository/IMAP.py",
line 452, in getfolders
imapobj = self.imapserver.acquireconnection()
File "/usr/lib64/python2.7/site-packages/offlineimap/imapserver.py", line
550, in acquireconnection
self.__authn_helper(imapobj)
File "/usr/lib64/python2.7/site-packages/offlineimap/imapserver.py", line
414, in __authn_helper
if func(imapobj):
File "/usr/lib64/python2.7/site-packages/offlineimap/imapserver.py", line
340, in __authn_plain
imapobj.authenticate('PLAIN', self.__plainhandler)
File "/usr/lib64/python2.7/site-packages/offlineimap/bundled_imaplib2.py",
line 734, in authenticate
typ, dat = self._simple_command('AUTHENTICATE', mechanism.upper())
File "/usr/lib64/python2.7/site-packages/offlineimap/bundled_imaplib2.py",
line 1740, in _simple_command
return self._command_complete(self._command(name, *args), kw)
File "/usr/lib64/python2.7/site-packages/offlineimap/bundled_imaplib2.py",
line 1466, in _command
literal = literator(data, rqb)
File "/usr/lib64/python2.7/site-packages/offlineimap/bundled_imaplib2.py",
line 2331, in process
ret = self.mech(self.decode(data))
File "/usr/lib64/python2.7/site-packages/offlineimap/imapserver.py", line
203, in __plainhandler
passwd = self.__getpassword()
File "/usr/lib64/python2.7/site-packages/offlineimap/imapserver.py", line
177, in __getpassword
self.password = self.repos.getpassword() or \
File "/usr/lib64/python2.7/site-packages/offlineimap/repository/IMAP.py",
line 392, in getpassword
return self.localeval.eval(passwd).encode('UTF-8')
_______________________________________________
OfflineIMAP-project mailing list: [email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/offlineimap-project
OfflineIMAP homepages:
- https://github.com/OfflineIMAP
- http://offlineimap.org