You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem when the subject of an email contains a special character such as "°".
In this case, the subject is
'subject': <email.header.Header object at 0x7f799db1d6d0>
Traceback :
Traceback (most recent call last):
File "src/index_emails.py", line 231, in
IOLoop.instance().run_sync(load_from_file)
File "/usr/lib/python3/dist-packages/tornado/ioloop.py", line 576, in run_sync
return future_cell[0].result()
File "/usr/lib/python3/dist-packages/tornado/ioloop.py", line 547, in run
result = func()
File "src/index_emails.py", line 196, in load_from_file
upload_batch(upload_data)
File "src/index_emails.py", line 93, in upload_batch
upload_data_txt += json.dumps(item) + "\n"
File "/usr/lib/python3.8/json/init.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type Header is not JSON serializable
Possible resolution in def convert_msg_to_json:
if "subject" in result:
result['subject'] = str(result['subject'])
The text was updated successfully, but these errors were encountered:
There is a problem when the subject of an email contains a special character such as "°".
In this case, the subject is
Traceback :
Possible resolution in def convert_msg_to_json:
The text was updated successfully, but these errors were encountered: