gpt4 book ai didi

python - __init__() 恰好接受 1 个参数(给定 3 个)Google 应用引擎

转载 作者:太空宇宙 更新时间:2023-11-03 11:03:35 24 4
gpt4 key购买 nike

我一直在上传我的 App Engine 应用程序的新版本,上传后当我发出请求时,我得到了这样的响应:

__init__() takes exactly 1 argument (3 given)
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1076, in __call__
handler = self.handler(request, response)
TypeError: __init__() takes exactly 1 argument (3 given)

我完全不知道该怎么做,我注释了我的部分代码,取消了注释,我已经将代码上传到我拥有的不同 GAE 应用程序,甚至是这些应用程序的多个版本。

我什至不知道从哪里开始 谁能告诉我这个错误甚至意味着什么?我会提供您要求的任何信息,在此先感谢您。

编辑:这是我添加的处理程序的样子:

class GCMRegister(webapp2.RequestHandler):
def post(self):
regid = self.request.get("regId")
if not regid:
self.response.out.write('Must specify regid')
else:
u = usuario()
u.name = "deadlybacon" # ax_length = 140)
u.mail = "testmail@hotmail.com" # (max_length = 256, db_index = True
u.password = "password" #max_length = 140)
u.put()
u.push_key(regid)

我的 WSGIApplication 看起来像这样:

application = webapp2.WSGIApplication([
('/', MainPage),

('/indexData', indexData),
('/ajaxLogIn', ajaxLogIn),
('/createGroup', createGroup),
('/masterServices', masterServices),
('/groupInfo', groupInfo),
('/groupInviteTo', groupInviteTo),
('/acceptNotif', acceptNotif),
('/adventureCreate', createAdventure),
('/adventureAppointTo', adventureAppointTo),
('/addNewPrueba', addNewPrueba),
('/listPoolPruebas', listPoolPruebas),
('/addExistingPrueba', addExistingPrueba),

('/gcm/register', GCMRegister),

]) #, debug=True, config = config)

一开始我以为是debug和config,所以才注释掉,没什么区别,不管怎样都会出现同样的错误

最佳答案

试试这个:

class HomeHandler(webapp2.RequestHandler):
def __init__(self, request, response):
self.initialize(request, response)
...

关于python - __init__() 恰好接受 1 个参数(给定 3 个)Google 应用引擎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26127164/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com