我有下面的代碼,通過匹配不同的圖案RuntimeError:最大遞歸深度超過
def urlChange(self, event):
text = self.txtUrl.GetValue()
matches = re.findall('GET (\S+).*Host: (\S+).*Cookie: (.+\S)\s*', text, re.DOTALL or re.MULTILINE)
if matches:
groups = matches[0]
self.txtUrl.SetValue(groups[1] + groups[0])
self.txtCookie.SetValue(groups[2])
else:
matches = re.findall('GET (\S+).*Host: (\S+).*', text, re.DOTALL or re.MULTILINE)
if matches:
groups = matches[0]
self.txtUrl.SetValue(groups[1] + groups[0])
self.txtCookie.Clear()
else:
matches = re.findall('.*(http://\S+)', text, re.DOTALL or re.MULTILINE)
if matches:
self.txtUrl.SetValue(matches[0])
matches = re.findall('.*Cookie: (.+\S)', text, re.DOTALL or re.MULTILINE)
if matches:
self.txtCookie.SetValue(matches[0])
提取從文本兩個字符串只有當最後re.findall('.*(http://\S+)'...
語句運行出現以下錯誤信息:
Traceback (most recent call last):
File "./curl-gui.py", line 105, in urlChange
text = self.txtUrl.GetValue()
RuntimeError: maximum recursion depth exceeded
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 48, in apport_excepthook
if not enabled():
File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 21, in enabled
import re
RuntimeError: maximum recursion depth exceeded while calling a Python object
Original exception was:
Traceback (most recent call last):
File "./curl-gui.py", line 105, in urlChange
text = self.txtUrl.GetValue()
RuntimeError: maximum recursion depth exceeded
我什麼都不知道,但它看起來像問題是'self.txtUrl.GetValue()`行。 「GetValue」有什麼作用? – Kobi 2011-01-12 12:06:06