我正在 Django 上开发一个 webapp,但在 Python 2.6.6 版本上出现错误,但它在 2.7 上运行良好
def check(attribute):
global rates
if (attribute.temperature_value < rates[0] or
attribute.temperature_value > rates[1] or
attribute.heartbeat_value<rates[2] or
attribute.heartbeat_value>rates[3]):
return True
else:
return False
Django 调试器显示存在语法错误。
另外,如果我尝试删除该功能,我会在另一行显示另一个错误
EOL while scanning string literal (views.py, line 109)
在第 109 行:
data = \
DataPool(
series=
[{'options': {
'source': values},
'terms': [
'current_time',
'temperature_value',
'heartbeat_value']}
])
谢谢你的帮助。
追溯:
File "/home/innovo/.local/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
101. request.path_info)
File "/home/innovo/.local/lib/python2.6/site-packages/django/core/urlresolvers.py" in resolve
300. sub_match = pattern.resolve(new_path)
File "/home/innovo/.local/lib/python2.6/site-packages/django/core/urlresolvers.py" in resolve
209. return ResolverMatch(self.callback, args, kwargs, self.name)
File "/home/innovo/.local/lib/python2.6/site-packages/django/core/urlresolvers.py" in callback
216. self._callback = get_callable(self._callback_str)
File "/home/innovo/.local/lib/python2.6/site-packages/django/utils/functional.py" in wrapper
27. result = func(*args)
File "/home/innovo/.local/lib/python2.6/site-packages/django/core/urlresolvers.py" in get_callable
92. lookup_view = getattr(import_module(mod_name), func_name)
File "/home/innovo/.local/lib/python2.6/site-packages/django/utils/importlib.py" in import_module
35. __import__(name)
Exception Type: SyntaxError at /
Exception Value: EOL while scanning string literal (views.py, line 114)