我的程序在添加少量文件时工作正常,但在文件列表 > 500 时崩溃。
错误:
The program 'gui.py' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAlloc (insufficient resources for operation)'.
(Details: serial 14768 error_code 11 request_code 53 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
编码:
self.tf_idf_document_list = gtk.ListStore(str)
self.tf_idf_tree_documents.set_model(self.tf_idf_document_list)
self.tf_idf_tree_column.set_attributes(self.tf_idf_renderer, text=0)
在 FileChooser 上,我选择包含文件的文件夹并将它们添加到列表中:
os.chdir(dir_name)
for file_name in os.listdir("."):
self.tf_idf_document_list.append([file_name])
任何关于如何解决这种 BoF 的建议。