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

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

Open
valir opened this issue Jun 23, 2022 · 5 comments
Open

Comments

@valir
Copy link

valir commented Jun 23, 2022

General informations

  • system/distribution (with version): OpenSuSE Tumbleweed
  • offlineimap version (offlineimap -V): offlineimap v7.3.4, imaplib2 v2.101 (bundled), Python v3.10.5, OpenSSL 1.1.1o 3 May 2022
  • Python version: Python 3.10.5
  • server name or domain: local instance of Davmail
  • CLI options: none

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:

  • install and start Davmail on port 1143
  • copy the configuration file above
  • attempt to run offlineimap
@robertvalik
Copy link

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
Copy link

mbucas commented Aug 23, 2022

This version of OfflineIMAP is compatible only with Python 2

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

@enfascination
Copy link

enfascination commented Mar 29, 2023

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
Copy link

enfascination commented Mar 29, 2023

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
Copy link

@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.

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

4 participants