Python suds出现“RuntimeError: 超过最大递归深度”问题

4 投票
4 回答
4324 浏览
提问于 2025-04-16 16:10

我正在调用一个Documentum的网络服务,开始时用了一段简单的代码:

from suds.client import Client #@UnresolvedImport  
from suds.transport.https import HttpAuthenticated  
import urllib2  
t=HttpAuthenticated(username='x', password='x')  
t.handler = urllib2.HTTPBasicAuthHandler(t.pm)  
t.urlopener = urllib2.build_opener(t.handler)  
url = 'http://hudt17:8888/services/core/ObjectService?wsdl'  
client = Client(url,transport=t)  
print client

当我使用这个网址 url='http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl' 时,一切都正常。但是如果我换成其他网址,就会出现错误:

https://docs.google.com/document/pub?id=1Qk8_qji385B9fZB-z4eMbPc1fv1AXVKEtbxr7Xx6AvQ

这到底是怎么回事呢?

4 个回答

1

这个问题在Suds的问题追踪系统中被认为是一个严重的bug:https://fedorahosted.org/suds/ticket/239

不幸的是,截至2012年,这个问题已经存在超过3年了。

1

你正在使用一个XSD模式,这个模式自己引用自己。

或者它引用了另一个模式,而那个模式又引用了第一个模式。

总之,这里有一个或多个模式之间存在循环依赖的情况。

5

这个问题有一个修复补丁:

https://fedorahosted.org/suds/attachment/ticket/239/recurselevel-schema.py.patch

在页面底部点击“原始格式”的链接。然后你可以使用以下命令来应用这个补丁:

patch schema.py < recurselevel-schema.py.patch

接着,从suds的源代码顶层目录安装,使用这个命令:

easy_install .

撰写回答