文件选择会触发下面的代码。
DELETE
当线程运行一些请求时,这会运行一个循环脉冲进度条。
在请求进行到一半时,窗口显示(未响应),一旦线程完成并且一切恢复正常,该窗口就会消失。
我做错了什么,我怎样才能解决(不响应)问题?
几个小时以来,我一直在努力寻找原因。
我认为这与请求有关,但我不知道如何。
def Process(self, event):
self._thread_end = False
self._process_success = False
threading.Thread(target=self.ProcessThread).start()
while not self._thread_end:
time.sleep(0.05)
self._gauge.Pulse()
self._gauge.SetValue(0)
self.PageResult(self._process_success)
def ProcessThread(self):
try:
csv_file = self._csv_dirname + '/' + self._csv_filename
if os.path.isfile(csv_file):
csv_contents = open(csv_file).read().replace('\r\n', '\n')
csv_list = filter(None, csv_contents.split('\n'))
for entry in csv_list:
http = urllib2.Request(self._logged_url + '/api/' + entry)
http.get_method = lambda: 'DELETE'
result = urllib2.urlopen(http)
self._process_success = True
except:
self._process_success = False
exc_type, exc_value, exc_traceback = sys.exc_info()
ExceptCatch(exc_type.__name__, exc_value, exc_traceback, threading.current_thread().name)
self._thread_end = True