Comments (13)
Thanks @thekix. It works on the simple test case I had. I have now sent the deb file to the original reporter of the problem and I will let you know after he replies. Thanks for the quick fix.
from offlineimap3.
The documentation says that the remotepasseval
configuration option (I guess that's what is used) must return a unicode string (str). If not offlineimap fails at encoding the bytes.
I wonder offlineimap should return a more user-friendly error message, though.
from offlineimap3.
@nicolas33 A git grep remotepasseval
doesnot show anything has changed between offlineimap and offlineimap3 so I will assume that the behaviour between them will remain same (unless I missed something). But David has mentioned in his bug report that this works with offlineimap.
from offlineimap3.
Just an update, I am able to reproduce the problem but I do see the problem with offlineimap also. I have requested David to reconfirm https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973408#17
with offlineimap.
from offlineimap3.
Please, make sure the user is returning a str type as requested by the documentation. It was already required with offlineimap (while some unsupported use cases did not hurt).
from offlineimap3.
Notice that I mean str in the python3 world. This means python unicode. The user might add something like mypasswordvar.decode('utf-8') if encoded in utf-8 just before returning the password.
from offlineimap3.
@nicolas33 offlineimaprc has remotepasseval = subprocess.check_output(['secret-tool', 'lookup', 'isp', 'mail']).strip()
. With that I have tested and it does work with offlineimap but fails with offlineimap3. But it looks to be a difference of python2 and python3.
sudip@debian:~$ python2.7 -c "import subprocess; print(subprocess.check_output(['secret-tool', 'lookup', 'isp','mail']).strip())"
test1235
`sudip@debian:~$` python3.8 -c "import subprocess; print(subprocess.check_output(['secret-tool', 'lookup', 'isp','mail']).strip())"
b'test1235'
sudip@debian:~$ python3.8 -c "import subprocess; print(subprocess.check_output(['secret-tool', 'lookup', 'isp','mail']).strip().decode('utf8'))"
test1235
So, with python2 I get test1235 which is a string and so offlineimap works. But with python3, I get a byte array (not string) and so offlineimap3 does not work which is exactly what you have said before. But after I added a decode, even though I now get a string but offlineimap3 still does not work and is now giving a different trace.
New trace:
ERROR: While attempting to sync account 'Gmail'
sequence item 2: expected str instance, bytes found
ERROR: Exceptions occurred during the run!
ERROR: While attempting to sync account 'Gmail'
sequence item 2: expected str instance, bytes found
Traceback:
File "/usr/lib/python3/dist-packages/offlineimap/accounts.py", line 298, in syncrunner
self.__sync()
File "/usr/lib/python3/dist-packages/offlineimap/accounts.py", line 374, in __sync
remoterepos.getfolders()
File "/usr/lib/python3/dist-packages/offlineimap/repository/IMAP.py", line 446, in getfolders
imapobj = self.imapserver.acquireconnection()
File "/usr/lib/python3/dist-packages/offlineimap/imapserver.py", line 579, in acquireconnection
self.__authn_helper(imapobj)
File "/usr/lib/python3/dist-packages/offlineimap/imapserver.py", line 443, in __authn_helper
if func(imapobj):
File "/usr/lib/python3/dist-packages/offlineimap/imapserver.py", line 369, in __authn_plain
imapobj.authenticate('PLAIN', self.__plainhandler)
File "/usr/lib/python3/dist-packages/imaplib2.py", line 691, in authenticate
typ, dat = self._simple_command('AUTHENTICATE', mechanism.upper())
File "/usr/lib/python3/dist-packages/imaplib2.py", line 1684, in _simple_command
return self._command_complete(self._command(name, *args), kw)
File "/usr/lib/python3/dist-packages/imaplib2.py", line 1404, in _command
literal = literator(data, rqb)
File "/usr/lib/python3/dist-packages/imaplib2.py", line 2247, in process
ret = self.mech(self.decode(data))
File "/usr/lib/python3/dist-packages/offlineimap/imapserver.py", line 213, in __plainhandler
retval = NULL.join((authz, authc, passwd))
from offlineimap3.
Hi,
sorry about my delay, I was busy these days. How can I reproduce the error? How can I configure the my user to use the remotepasseval variable? Any how-to to do it?
Thanks a lot,
regards,
kix
from offlineimap3.
- install libsecret-tools
- store a password:
secret-tool store --label='mail' isp mail
- verify the password is saved:
secret-tool lookup isp mail
- In .offlineimaprc use
remotepasseval = subprocess.check_output(['secret-tool', 'lookup', 'isp', 'mail']).strip()
instead of remotepass. And add a python file with "import subprocess" to pythonfile in [general]
My .offlineimaprc says:
[general]
ui = ttyui
accounts = Gmail
pythonfile = /home/sudip/offlineimap.py
And the file "/home/sudip/offlineimap.py" only has import subprocess
from offlineimap3.
Thanks a lot for your quick reply. I think the bug is now solved. Please, can you test it?
I also uploaded some patches about code style, docstrings and some pylint warnings.
from offlineimap3.
@thekix thanks again, That issue is fixed now. But there is another one. And, as before it works with offlineimap but fails with offlineimap3.
Steps to reporduce:
- extract the attached file and use it as
pythonfile
in [general]. - Add
nametrans
to your .offlineimaprc.
nametrans = lambda foldername: foldername.decode('imap4-utf-7').encode('utf-8')
Do you want me to open a separate issue for this?
from offlineimap3.
Thanks for this new report. I am working on it. Please, open a new issue to close it using the new patch, then we have these problems documented for the future.
Regards,
kix
from offlineimap3.
Thanks @thekix. #23 has been opened for this.
from offlineimap3.
Related Issues (20)
- Why does the readme recommend an AUR package? HOT 3
- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed error HOT 4
- Offlineimap config files not stored when installing via `pip` HOT 7
- APPEND command error: BAD ['invalid rfc5322 message: Sender should not be present if equal to From'] HOT 3
- offlineimap3 produces error due to defect in Spam email HOT 6
- Support py3.12 HOT 1
- ERROR: UID 11544 has defects preventing it from being processed! HOT 2
- No module named commands error (Debian) HOT 1
- Syncronization of previously deleted/moved emails: 'failed to label messages: Message does not exist'
- "tmp" folder conflicts with mapfilenametmp
- keyring has broken user environment and scripts HOT 2
- Imaputil quote function should escape backslashes first and then quotes
- TypeError: decoding with '136' codec failed (TypeError: utf7m_decode() takes 1 positional argument but 2 were given)
- Document reasoning for having maxsyncaccounts
- IMAP <> IMAP sync introduces a large fixed offset for the received date-time when mail headers contain a negative timezone (eg a USA-based remote mail host). HOT 1
- IMAP with outlook.office365.com and XOAUTH2 fails since 18-Feb-2024 with `command LIST illegal in state NONAUTH`
- Cannot handle 'already exists' and 'Cannot create this folder' messages when syncing folders with Courier IMAP
- Incompatible with Python 3.12 HOT 4
- KeyError: 'cygwin' when installing
- openssl password decryption error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from offlineimap3.