在 Python 中,Spyne 出现了很多问题
In Python got many issues with Spyne
嗯,这是我的 Python 代码:
#!/usr/bin/env python
from spyne import Application, rpc, ServiceBase, Unicode
from lxml import etree
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
# Wsgi это Web server Getewap Interface - стандар взаимодействия с питон программой и серверо где он работает
class Soap(ServiceBase):
@rpc(Unicode, _return=Unicode)
def Insoap(ctx, words):
print("Connection detected: ", etree.tostring(ctx.in_document))
ww = str(words).capitalize()
return ww
app = Application([Soap], tns='Capitalize', in_protocol=Soap11(validator='lxml'), out_protocol=Soap11())
application = WsgiApplication(app) # Важна названия переменной, иначе сервер не поймет
if __name__ == '__main__':
from wsgiref.simple_server import make_server
server = make_server('localhost', 8002, application)
server.serve_forever()
但是出现这个错误,请问是什么问题?我应该怎么做才能解决?请帮我解决这个问题
Traceback (most recent call last):
File "C:/Users/David374/PycharmProjects/untitled8/venv/test.py", line 3, in <module>
from spyne import Application, rpc, ServiceBase, Iterable, UnsignedInteger, \
File "C:\Users\David374\PycharmProjects\untitled8\venv\lib\site-packages\spyne\__init__.py", line 63, in <module>
from spyne.server import ServerBase, NullServer
File "C:\Users\David374\PycharmProjects\untitled8\venv\lib\site-packages\spyne\server\__init__.py", line 23, in <module>
from spyne.server.null import NullServer
File "C:\Users\David374\PycharmProjects\untitled8\venv\lib\site-packages\spyne\server\null.py", line 69
self.service = _FunctionProxy(self, self.app, async=False)
^
SyntaxError: invalid syntax
async
是 Python 3.7+ 中的保留关键字,您需要使用最新版本的 Spyne,它不会在其函数中使用该保留关键字作为参数, 如果您想将它与 Python 3.7+.
一起使用
要么将 Spyne 更新为 spyne-2.13.2-alpha
,要么使用 Python 3.6
或更低版本。
来源:
嗯,这是我的 Python 代码:
#!/usr/bin/env python
from spyne import Application, rpc, ServiceBase, Unicode
from lxml import etree
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
# Wsgi это Web server Getewap Interface - стандар взаимодействия с питон программой и серверо где он работает
class Soap(ServiceBase):
@rpc(Unicode, _return=Unicode)
def Insoap(ctx, words):
print("Connection detected: ", etree.tostring(ctx.in_document))
ww = str(words).capitalize()
return ww
app = Application([Soap], tns='Capitalize', in_protocol=Soap11(validator='lxml'), out_protocol=Soap11())
application = WsgiApplication(app) # Важна названия переменной, иначе сервер не поймет
if __name__ == '__main__':
from wsgiref.simple_server import make_server
server = make_server('localhost', 8002, application)
server.serve_forever()
但是出现这个错误,请问是什么问题?我应该怎么做才能解决?请帮我解决这个问题
Traceback (most recent call last):
File "C:/Users/David374/PycharmProjects/untitled8/venv/test.py", line 3, in <module>
from spyne import Application, rpc, ServiceBase, Iterable, UnsignedInteger, \
File "C:\Users\David374\PycharmProjects\untitled8\venv\lib\site-packages\spyne\__init__.py", line 63, in <module>
from spyne.server import ServerBase, NullServer
File "C:\Users\David374\PycharmProjects\untitled8\venv\lib\site-packages\spyne\server\__init__.py", line 23, in <module>
from spyne.server.null import NullServer
File "C:\Users\David374\PycharmProjects\untitled8\venv\lib\site-packages\spyne\server\null.py", line 69
self.service = _FunctionProxy(self, self.app, async=False)
^
SyntaxError: invalid syntax
async
是 Python 3.7+ 中的保留关键字,您需要使用最新版本的 Spyne,它不会在其函数中使用该保留关键字作为参数, 如果您想将它与 Python 3.7+.
要么将 Spyne 更新为 spyne-2.13.2-alpha
,要么使用 Python 3.6
或更低版本。
来源: