错误详细信息
说明 我有一个提取电子邮件文件的应用程序。如果电子邮件文件包含gbk编解码器(中文字符),则模块方法Message(文件路径)将引发异常。
代码段
from extract_msg import Message
try:
msg = Message(vault_path)
except Exception as e:
return action_result.set_status(APP_ERROR, "Failed to parse message. Error: {0}".format(str(e)))
来自库调用的错误消息
“消息”:“无法解析消息。错误:'gbk'编解码器无法解码位置34-35中的字节:非法的多字节序列”
跟踪:
File "/opt/folder/dependencies/extract_msg/message.py", line 95, in __init__#012 self.body#012
File "/opt/folder/dependencies/extract_msg/message.py", line 460, in body#012 self._body = self._getStringStream('__substg1.0_1000')#012
File "/opt/folder/dependencies/extract_msg/message.py", line 166, in _getStringStream#012 return None if tmp is None else
tmp.decode(self.stringEncoding)#012UnicodeDecodeError: 'gbk' codec can't decode bytes in position 34-35: illegal multibyte sequence
不允许我共享.msg文件。该文件具有gbk编解码器(汉字)