我正在尝试运行我的Google应用引擎应用,我用来调整地图上的折线。我测试了localhost上的功能,一切顺利。但是,在我部署项目之后:
'float' object has no attribute '__getitem__'
提高。
'float' object has no attribute '__getitem__'
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 1077, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~cdotmap/streetcenterline.374700366610028884/handlers/mapdata.py", line 112, in get
data["features"][i] = centerLine(data["features"][i])
File "/base/data/home/apps/s~cdotmap/streetcenterline.374700366610028884/functions.py", line 141, in centerLine
lng, lat = point[0], point[1]
TypeError: 'float' object has no attribute '__getitem__'
这意味着我以point
成为float
对象而我无法访问,实际代码在这里:
points = []
points.append([0.2, 0.3])
points.append([0.5, 0.8])
我构建了两个列表的列表,每个列表包含两个浮点数,然后我尝试将其分配给其他类似的:
for point in points:
lng, lat = point[0], point[1] #error pointing to this line
引发的错误。这只发生在我部署应用程序时。这里有任何线索,任何事情都会有所帮助!
谢谢!