我正在尝试从Linux执行python脚本,但是我一直在except行上收到此错误。有人可以弄清楚吗?
$ python pygeo_ip.py
def search(self):
message = ''
result_count = 0
gip = pygeoip.GeoIP('GeoLIteCity.dat')
ip = self.ip_textbox.text()
try:
ip = socket.gethostbyname(str(ip))
message = "Host: %s Is Currently Available" % (str(ip))
except socket.error, e:
message = "Host: %s Is Currently Unavailable" % (key, val)
result_count += 1
msg_box("SeArCh CoMpLeTe", "%d REsults Were Found For %s"
% (result_count, str(ip))
except Exception, e: <------- Error
msg_box("", str(e))
msg_box("Search Complete", "No Results Were Found For %s" % (str(ip))
return
错误:
File "pygeo_ip.py", line 142
except Exception, e:
^
SyntaxError: invalid syntax
答案 0 :(得分:0)
可以肯定(没有进行任何测试)您的问题错过了最后一个括号
该行应显示为:
msg_box("SeArCh CoMpLeTe", "%d REsults Were Found For %s" % (result_count, str(ip)) )