zeep客户端抛出UnicodeDecodeError utf8编解码器无法解码字节

2024-05-15 03:51:51 发布

您现在位置:Python中文网/ 问答频道 /正文

在linux上,我尝试编写一个连接到windows SOAP服务的程序(在这个问题的上下文中,操作系统可能很重要)

我通过以下方式连接到此服务:

class GWS:
   def __init__:
       self.config = configparser.ConfigParser()
       self.config.read(join(os.path.dirname(os.path.realpath(__file__)), "configuration.ini"))
       self.gClient = zeep.Client(wsdl=self.config["G"]["g_wsdl_url"])
...

然后我试着打电话给这样的服务

...
self.gWS = GWS()
self.gService = self.gWS.gClient.service
...
arf = self.g.GetAbrResultFiles(tfile.DT_ID, self.s.secret)

than的最后一行抛出错误,即: “UnicodeDecodeError:'utf-8'编解码器无法解码位置0:无效起始字节中的字节0xff”或“UnicodeDecodeError:'utf-8'编解码器无法解码位置4:无效延续字节中的字节0xd9” ,但字节值和位置可能不同

我试图“解码('ISO-1252-1')”或“解码('utf-8')”,但没有成功

谁有主意,这里有什么问题


Tags: pathselfconfig字节oslinuxwindows编解码器

热门问题