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

imapserver.acquireconnection(): <class 'TypeError'> - cannot use a bytes pattern on a string-like object #472

Closed
rizzopablo opened this issue May 23, 2017 · 10 comments

Comments

@rizzopablo
Copy link

I'm getting this error using Python3 from Archlinux, what could it be?

Logs, error

pip install offlineimap

Collecting offlineimap
Downloading offlineimap-7.1.0.tar.gz (219kB)
100% |████████████████████████████████| 225kB 540kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-_8nc_1ks/offlineimap/setup.py", line 26, in
import offlineimap
File "/tmp/pip-build-_8nc_1ks/offlineimap/offlineimap/init.py", line 20, in
from offlineimap.init import OfflineImap
File "/tmp/pip-build-_8nc_1ks/offlineimap/offlineimap/init.py", line 29, in
import offlineimap.virtual_imaplib2 as imaplib
File "/tmp/pip-build-_8nc_1ks/offlineimap/offlineimap/virtual_imaplib2.py", line 36, in
if (int(imaplib.release) < _SUPPORTED_RELEASE or
AttributeError: module 'imaplib2' has no attribute 'release'

@nicolas33
Copy link
Member

Quite possible. We don't support Py3.

@rizzopablo
Copy link
Author

Oh... Ok

I uninstalled imaplib2 and now the error is this:

$ offlineimap
OfflineIMAP 7.1.0
Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
Account sync correo:
*** Processing account correo
Establishing connection to rshg101.dnsready.net:143 (Remote)
ERROR: While attempting to sync account 'correo'
IMAP4 protocol error: program error: <class 'TypeError'> - cannot use a bytes pattern on a string-like object
*** Finished account 'correo' in 0:00
ERROR: Exceptions occurred during the run!
ERROR: While attempting to sync account 'correo'
IMAP4 protocol error: program error: <class 'TypeError'> - cannot use a bytes pattern on a string-like object

Traceback:
File "/usr/lib/python3.6/site-packages/offlineimap/accounts.py", line 281, in syncrunner
self.__sync()
File "/usr/lib/python3.6/site-packages/offlineimap/accounts.py", line 344, in __sync
remoterepos.getfolders()
File "/usr/lib/python3.6/site-packages/offlineimap/repository/IMAP.py", line 452, in getfolders
imapobj = self.imapserver.acquireconnection()
File "/usr/lib/python3.6/site-packages/offlineimap/imapserver.py", line 551, in acquireconnection
af=self.af,
File "/usr/lib/python3.6/site-packages/offlineimap/imaplibutil.py", line 226, in init
IMAP4.init(self, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/offlineimap/bundled_imaplib2.py", line 400, in init
self.welcome = self._request_push(name='welcome', tag='continuation').get_response('IMAP4 protocol error: %s')[1]
File "/usr/lib/python3.6/site-packages/offlineimap/bundled_imaplib2.py", line 201, in get_response
raise typ(exc_fmt % str(val))

@nicolas33
Copy link
Member

Ok, thanks for the report.

Notice you're still running offlineimap with python3.

@nicolas33 nicolas33 changed the title AttributeError: module 'imaplib2' has no attribute '__release__' imapserver.acquireconnection(): IMAP4 protocol error: program error: <class 'TypeError'> - cannot use a bytes pattern on a string-like object May 23, 2017
@nicolas33 nicolas33 changed the title imapserver.acquireconnection(): IMAP4 protocol error: program error: <class 'TypeError'> - cannot use a bytes pattern on a string-like object imapserver.acquireconnection(): <class 'TypeError'> - cannot use a bytes pattern on a string-like object May 23, 2017
@nicolas33
Copy link
Member

You might like to remove this version of offlineimap since this was installed using pip for python 3.

@rizzopablo
Copy link
Author

I'm now running it with py2 and works great, but I'm on a py3 project and would need to run offlineimap with the same python version.
Thanks!

@nicolas33
Copy link
Member

This would require to support py3 in the first place. So, this is currently not possible. I'm not sure this day will come for offlineimap. We tried to support py3 but we stopped. That's why I introduced imapfw but it's still in a very early development stage.

@ff2000
Copy link

ff2000 commented Dec 4, 2019

Was there some progress regarding py3 support? Py2 will be unsupported in less than 1 month. As imapfw never really took off having py3 support in OfflineImap would be really needed.

@nicolas33
Copy link
Member

nicolas33 commented Dec 4, 2019

No, there was no progress regarding py3 support. I'll make the announce about this before the end of the year.

The short story is:

  1. I still intend to contribute to imapfw but I lacking free time curently mostly because my family is growing.
  2. I don't think offlineimap will ever be ported while contributions are welcome.
  3. I'll continue to maintain offlineimap during months after the py2 (edited) end of life.

@chris001
Copy link
Member

chris001 commented Dec 6, 2019

Was there some progress regarding py3 support? Py2 will be unsupported in less than 1 month. As imapfw never really took off having py3 support in OfflineImap would be really needed.

Hello @ff2000 and @rizzopablo
If you, or your organization/company, would like to explore the possibility to sponsor the development of a port to Python3 of classic offlineimap, and/or to sponsor the ongoing development of the new next-generation IMAPfw software which is designed for Python3, then please click on the "Sponsor" button, at the top of this page, and consider becoming a Backer (only $5/month), or consider your company becoming a Sponsor (only $100/month)!

More exciting benefits include: your organization's/company's logo and social media page mentioned in the official OfflineIMAP social media, and in the software's official release notes!

@thekix
Copy link
Contributor

thekix commented Sep 4, 2020

Hi,

IMO, this issue should be closed and merged with #670

Cheers,
kix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants