Open dominique-unruh opened 1 year ago
I use the same version of offlineimap and get the same error message.
Actually the error I get is similar but a little bit different:
Folder NewTemp1 [acc: main]:
Copy message UID 538 (1/17) main-remote:NewTemp1 -> main-local:NewTemp1
Copy message UID 539 (2/17) main-remote:NewTemp1 -> main-local:NewTemp1
Copy message from main-remote:NewTemp1:
ERROR: Copying message 538 [acc: main]
'ascii' codec can't encode characters in position 391-392: ordinal not in range(128)
Thread 'Copy message from main-remote:NewTemp1' terminated with exception:
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/folder/Base.py", line 815, in copymessageto
new_uid = dstfolder.savemessage(uid, message, flags, rtime)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/offlineimap3/offlineimap/folder/Maildir.py", line 409, in savemessage
tmpname = self.save_to_tmp_file(messagename, msg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/offlineimap3/offlineimap/folder/Maildir.py", line 359, in save_to_tmp_file
fd.write(msg.as_bytes(policy=output_policy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/email/message.py", line 208, in as_bytes
g.flatten(self, unixfrom=unixfrom)
File "/usr/lib/python3.11/email/generator.py", line 116, in flatten
self._write(msg)
File "/usr/lib/python3.11/email/generator.py", line 181, in _write
self._dispatch(msg)
File "/usr/lib/python3.11/email/generator.py", line 218, in _dispatch
meth(msg)
File "/usr/lib/python3.11/email/generator.py", line 276, in _handle_multipart
g.flatten(part, unixfrom=False, linesep=self._NL)
File "/usr/lib/python3.11/email/generator.py", line 116, in flatten
self._write(msg)
File "/usr/lib/python3.11/email/generator.py", line 181, in _write
self._dispatch(msg)
File "/usr/lib/python3.11/email/generator.py", line 218, in _dispatch
meth(msg)
File "/usr/lib/python3.11/email/generator.py", line 268, in _handle_multipart
self.write(subparts)
File "/usr/lib/python3.11/email/generator.py", line 410, in write
self._fp.write(s.encode('ascii', 'surrogateescape'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode characters in position 391-392: ordinal not in range(128)
Last 2 debug messages logged for Copy message from main-remote:NewTemp1 prior to exception:
thread: Register new thread 'Copy message from main-remote:NewTemp1' (account 'main')
maildir: Write mail 'NewTemp1:538' with flags {'T', 'S'}
ERROR: Exceptions occurred during the run!
ERROR: Copying message 538 [acc: main]
'ascii' codec can't encode characters in position 391-392: ordinal not in range(128)
Traceback:
File "/usr/share/offlineimap3/offlineimap/folder/Base.py", line 815, in copymessageto
new_uid = dstfolder.savemessage(uid, message, flags, rtime)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/offlineimap3/offlineimap/folder/Maildir.py", line 409, in savemessage
tmpname = self.save_to_tmp_file(messagename, msg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/offlineimap3/offlineimap/folder/Maildir.py", line 359, in save_to_tmp_file
fd.write(msg.as_bytes(policy=output_policy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/email/message.py", line 208, in as_bytes
g.flatten(self, unixfrom=unixfrom)
File "/usr/lib/python3.11/email/generator.py", line 116, in flatten
self._write(msg)
File "/usr/lib/python3.11/email/generator.py", line 181, in _write
self._dispatch(msg)
File "/usr/lib/python3.11/email/generator.py", line 218, in _dispatch
meth(msg)
File "/usr/lib/python3.11/email/generator.py", line 276, in _handle_multipart
g.flatten(part, unixfrom=False, linesep=self._NL)
File "/usr/lib/python3.11/email/generator.py", line 116, in flatten
self._write(msg)
File "/usr/lib/python3.11/email/generator.py", line 181, in _write
self._dispatch(msg)
File "/usr/lib/python3.11/email/generator.py", line 218, in _dispatch
meth(msg)
File "/usr/lib/python3.11/email/generator.py", line 268, in _handle_multipart
self.write(subparts)
File "/usr/lib/python3.11/email/generator.py", line 410, in write
self._fp.write(s.encode('ascii', 'surrogateescape'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
time="2023-09-03T16:08:49.823Z" level=info msg="sub-process exited" argo=true error="<nil>"
Error: exit status 100
and as the subject or email address is not logged it is hard for me the find the email that caused this problem.
Hi, I have a similar issue:
https://github.com/OfflineIMAP/offlineimap3/issues/165
My expectation would be that the email is backed up anyway, including any bad encodings or similar.
I'm a beginner and thought the same, but now I have some doubts: if it's improperly structured it might be really hard to search for content, and if I can't find it, it's effectively lost, even if on disk. For example, I can't use
notmuch search body:MYSEARCHTERM
if notmuch doesn't know what the "body" is.
Would it be possible to download it, but warn that it's not properly parsed? Then one can fix it locally before letting parse by a search database.
I encounter the same error when trying to sync my Gmail account. I can't judge if the mail should be synced raw or dropped, but I would expect offlineimap to continue the sync.
Version: offlineimap 8.0.0 Server: Gmail
Hi,
after apply #107, is this problem solved?
Best regards, kix
I'm still getting an error for one of the accounts I sync. unfortunately it is too difficult to determine which of the 10,000 emails is causing this error, but here is the error block
ERROR: while syncing [Gmail]/All Mail [account GMail]
'ascii' codec can't encode characters in position 365-370: ordinal not in range(128)
ERROR: ERROR in syncfolder for GMail folder [Gmail]/All Mail: Traceback (most recent call last):
File "/srv/offlineimap3/offlineimap/accounts.py", line 661, in syncfolder
remotefolder.syncmessagesto(localfolder, statusfolder)
File "/srv/offlineimap3/offlineimap/folder/Base.py", line 1177, in syncmessagesto
action(dstfolder, statusfolder)
File "/srv/offlineimap3/offlineimap/folder/Gmail.py", line 363, in syncmessagesto_labels
dstfolder.savemessagelabels(uid, selflabels, ignorelabels=self.ignorelabels)
File "/srv/offlineimap3/offlineimap/folder/GmailMaildir.py", line 178, in savemessagelabels
tmpname = self.save_to_tmp_file(messagename, msg)
File "/srv/offlineimap3/offlineimap/folder/Maildir.py", line 359, in save_to_tmp_file
fd.write(msg.as_bytes(policy=output_policy))
File "/usr/lib/python3.10/email/message.py", line 178, in as_bytes
g.flatten(self, unixfrom=unixfrom)
File "/usr/lib/python3.10/email/generator.py", line 116, in flatten
self._write(msg)
File "/usr/lib/python3.10/email/generator.py", line 181, in _write
self._dispatch(msg)
File "/usr/lib/python3.10/email/generator.py", line 218, in _dispatch
meth(msg)
File "/usr/lib/python3.10/email/generator.py", line 276, in _handle_multipart
g.flatten(part, unixfrom=False, linesep=self._NL)
File "/usr/lib/python3.10/email/generator.py", line 116, in flatten
self._write(msg)
File "/usr/lib/python3.10/email/generator.py", line 181, in _write
self._dispatch(msg)
File "/usr/lib/python3.10/email/generator.py", line 218, in _dispatch
meth(msg)
File "/usr/lib/python3.10/email/generator.py", line 362, in _handle_message
g.flatten(msg.get_payload(0), unixfrom=False, linesep=self._NL)
File "/usr/lib/python3.10/email/generator.py", line 116, in flatten
self._write(msg)
File "/usr/lib/python3.10/email/generator.py", line 181, in _write
self._dispatch(msg)
File "/usr/lib/python3.10/email/generator.py", line 218, in _dispatch
meth(msg)
File "/usr/lib/python3.10/email/generator.py", line 268, in _handle_multipart
self.write(subparts)
File "/usr/lib/python3.10/email/generator.py", line 410, in write
self._fp.write(s.encode('ascii', 'surrogateescape'))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 365-370: ordinal not in range(128)
'ascii' codec can't encode characters in position 365-370: ordinal not in range(128)
General informations
offlineimap -V
): v8.0.0 (but probably a very recent git master because I installed using AUR packageofflineimap3-git
).offlineimap -c config/offlineimap.conf -a gmail-work
Configuration file offlineimaprc
pythonfile (if any)
none
Logs, error
Steps to reproduce the error
The source code of the email is as follows. (Copy and pasted from Thunderbird's show source, I don't know if that changes some encoding issues.) Replaced my username by
XXXXXXX
. If needed, I can try other specific ways to get the source (I won't delete the email for now).