OfflineIMAP / offlineimap

Read/sync your IMAP mailboxes (python2) [LEGACY: move to offlineimap3]
http://www.offlineimap.org
Other
1.78k stars 360 forks source link

IMAP4 protocol error - cannot use a bytes pattern on a string-like object #721

Open valir opened 2 years ago

valir commented 2 years ago

General informations

Configuration file offlineimaprc

[general] accounts = intel

[Account intel] localrepository = intel-local remoterepository = intel-remote

[Repository intel-local] type = Maildir localfolders = ~/Mail/intel

[Repository intel-remote] type = IMAP starttls = no ssl = no remotehost = localhost remoteport = 1143 remoteuser = valir remotepass = somePassword auth_mechanisms = LOGIN maxconnections = 3

[mbnames] enabled = yes filename = ~/.mutt/mailboxes header = "mailboxes " peritem = "+%(accountname)s/%(foldername)s"

peritem = "~/Mail/movidius/%(foldername)s"

sep = " " footer = "\n"

pythonfile (if any)

no python file

Logs, error

$ offlineimap 130 ↵ OfflineIMAP 7.3.4 Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception) imaplib2 v2.101 (bundled), Python v3.10.5, OpenSSL 1.1.1o 3 May 2022 Account sync intel: Processing account intel Establishing connection to localhost:1143 (intel-remote) ERROR: While attempting to sync account 'intel' IMAP4 protocol error: program error: <class 'TypeError'> - cannot use a bytes pattern on a string-like object Finished account 'intel' in 0:00 ERROR: can't have text and binary mode at once ERROR: Exceptions occurred during the run! ERROR: While attempting to sync account 'intel' IMAP4 protocol error: program error: <class 'TypeError'> - cannot use a bytes pattern on a string-like object

Traceback: File "/home/vrusu/.local/lib/python3.10/site-packages/offlineimap/accounts.py", line 293, in syncrunner self.sync() File "/home/vrusu/.local/lib/python3.10/site-packages/offlineimap/accounts.py", line 372, in sync remoterepos.getfolders() File "/home/vrusu/.local/lib/python3.10/site-packages/offlineimap/repository/IMAP.py", line 452, in getfolders imapobj = self.imapserver.acquireconnection() File "/home/vrusu/.local/lib/python3.10/site-packages/offlineimap/imapserver.py", line 574, in acquireconnection imapobj = imaplibutil.WrappedIMAP4( File "/home/vrusu/.local/lib/python3.10/site-packages/offlineimap/imaplibutil.py", line 237, in init IMAP4.init(self, *args, **kwargs) File "/home/vrusu/.local/lib/python3.10/site-packages/offlineimap/bundled_imaplib2.py", line 399, in init self.welcome = self._request_push(name='welcome', tag='continuation').get_response('IMAP4 protocol error: %s')[1] File "/home/vrusu/.local/lib/python3.10/site-packages/offlineimap/bundled_imaplib2.py", line 200, in get_response raise typ(exc_fmt % str(val))

ERROR: can't have text and binary mode at once

Steps to reproduce the error

This is a fresh install, on a newly installed system, so:

robertvalik commented 2 years ago

Same here, after changing python from 2.9 to 3.9 and reinstalling offlineimap I get the same error on Gentoo (.offlineimaprc did not change). Version: offlineimap v7.3.4, imaplib2 v2.101 (bundled), Python v3.9.13, OpenSSL 1.1.1q 5 Jul 2022

mbucas commented 2 years ago

This version of OfflineIMAP is compatible only with Python 2

You can find the Python 3 version here : http://github.com/OfflineIMAP/offlineimap3

enfascination commented 1 year ago

This version of OfflineIMAP is compatible only with Python 2

Really @mbucas ? The offlineimap -V from @robertvalik shows Python v3.9.13. Am I wrong to read that as evidence that he's reporting this error from offlineimap3? Isn't the executable for offlineimap3 also called offlineimap?

@valir or @robertvalik , did either of you diagnose this? I'm getting the same error (and on a quite different setup: on macos, with offlineimap set up for oauth).

UPDATE: just confirmed that I'm getting this identical error despite using offlineimap3 (this build)

enfascination commented 1 year ago

I was getting this issue with the offlineimap3 currently available on pip (offlineimap v7.3.4, imaplib2 v2.101 (bundled), Python v3.8.8, OpenSSL 1.1.1k 25 Mar 2021) but don't get it through the one available from another package manager (macports; offlineimap v8.0.0, imaplib2 v3.06, Python v3.10.10, OpenSSL 3.1.0 14 Mar 2023).

Since all three of us reporting this issue had it on v7.3.4, and it seems to be gone on a more recent version, it may be that this issue has been fixed in the code and will stop being encountered by users once the version available on pip is updated.

robertvalik commented 1 year ago

@enfascination mcubas did point out that this repo is for older offlineimap for python2 and not for the py3 offlineimap. After that I have opened an issue in the offlineimap3 repo - issue 133 and I have abandoned it after migrating to isync.