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

Problem with .strip("\n") in IMAP.py #211

Open
SimonMaths opened this issue Dec 24, 2024 · 0 comments
Open

Problem with .strip("\n") in IMAP.py #211

SimonMaths opened this issue Dec 24, 2024 · 0 comments

Comments

@SimonMaths
Copy link

General informations

When using the oauth2_refresh_token_eval option in my configuration file I get the error below.
This appear to a problem with at least one of the following lines in offlineimap/repository/IMAP.py

440:                refresh_token = refresh_token.strip("\n")
457:                access_token = access_token.strip("\n")
474:                client_id = client_id.strip("\n")
491:                client_secret = client_secret.strip("\n")

as the problem is fixed by replacing ("\n") with (b"\n")

Configuration file offlineimaprc

This error occurs when using the configuration property:

   oauth2_refresh_token_eval = ...

Logs, error

Traceback (most recent call last):
File "/usr/share/offlineimap3/offlineimap/threadutil.py", line 146, in run
Thread.run(self)
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/usr/share/offlineimap3/offlineimap/accounts.py", line 283, in syncrunner
self.remoterepos = Repository(self, 'remote')
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/offlineimap3/offlineimap/repository/init.py", line 77, in new
return repo(name, account)
^^^^^^^^^^^^^^^^^^^
File "/usr/share/offlineimap3/offlineimap/repository/IMAP.py", line 43, in init
self.imapserver = imapserver.IMAPServer(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/offlineimap3/offlineimap/imapserver.py", line 108, in init
self.oauth2_refresh_token = repos.getoauth2_refresh_token()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/offlineimap3/offlineimap/repository/IMAP.py", line 440, in getoauth2_refresh_token
refresh_token = refresh_token.strip("\n")
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: a bytes-like object is required, not 'str'

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

1 participant