Offlineimap not working after big update


Since the last (big) update, I have some troubles to make offlineimap working.
I read this Offlineimap throwing error now - #6 by mithrial but it doesn’t apply to me, I think.
I have offlineimap 8.0.0-1 installed.
I have python versions 2 and 3.

Here is the traceback. Is this about a python error?

ERROR: Exceptions occurred during the run!
ERROR: While attempting to sync account 'myaccount'
  a bytes-like object is required, not 'str'

  File "/usr/lib/python3.9/site-packages/offlineimap/", line 298, in syncrunner
  File "/usr/lib/python3.9/site-packages/offlineimap/", line 374, in __sync
  File "/usr/lib/python3.9/site-packages/offlineimap/repository/", line 681, in getfolders
    imapobj = self.imapserver.acquireconnection()
  File "/usr/lib/python3.9/site-packages/offlineimap/", line 593, in acquireconnection
  File "/usr/lib/python3.9/site-packages/offlineimap/", line 445, in __authn_helper
    if func(imapobj):
  File "/usr/lib/python3.9/site-packages/offlineimap/", line 371, in __authn_plain
    imapobj.authenticate('PLAIN', self.__plainhandler)
  File "/usr/lib/python3.9/site-packages/imaplib2/", line 712, in authenticate
    typ, dat = self._simple_command('AUTHENTICATE', mechanism.upper())
  File "/usr/lib/python3.9/site-packages/imaplib2/", line 1705, in _simple_command
    return self._command_complete(self._command(name, *args), kw)
  File "/usr/lib/python3.9/site-packages/imaplib2/", line 1425, in _command
    literal = literator(data, rqb)
  File "/usr/lib/python3.9/site-packages/imaplib2/", line 2268, in process
    ret = self.mech(self.decode(data))
  File "/usr/lib/python3.9/site-packages/offlineimap/", line 211, in __plainhandler
    passwd = self.__getpassword()
  File "/usr/lib/python3.9/site-packages/offlineimap/", line 179, in __getpassword
    self.password = self.repos.getpassword() or \
  File "/usr/lib/python3.9/site-packages/offlineimap/repository/", line 585, in getpassword
    l_pass = self.localeval.eval(passwd)
  File "/usr/lib/python3.9/site-packages/offlineimap/", line 45, in eval
    return eval(text, names)
  File "<string>", line 1, in <module>
  File "/home/alex/", line 20, in get_passmyaccount
    return check_output("gpg -dq ~/.mutt/pwmyaccount.gpg", shell=True).strip("\n")

Press any key to continue...

From the stacktrace, the error is in your /home/alex/ script which I believe at some point was defined by you?
Since offlineimap 8.0.0, it’s using Python 3, so you have to adjust your script to the new version.

For the record, I changed my
It was written following OfflineIMAP - ArchWiki (section Uging gpg).
I changed:

def get_pass():
    return check_output("gpg -dq ~/.offlineimappass.gpg", shell=True).strip("\n")


def get_pass():
    return check_output("gpg -dq ~/.offlineimappass.gpg", shell=True).splitlines()[0]

and it works. :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.