Question:
wx._ core.wxAssertionError : C++ assertion “m_ count > 0” failed at … \src\common\ object.cpp (352) in wxRefCounter::DecRef(): invalid ref data count
Causes of the problem:
attr = wx.grid.GridCellAttr()
for i in range(len(lis)):
editor = wx.grid.GridCellBoolEditor()
self.SetCellEditor(i + 1, 0, editor)
self.SetCellRenderer(i + 1, 0, wx.grid.GridCellBoolRenderer())
for j in range(len(lis[i])):
self.SetCellValue(i + 1, j + 1, lis[i][j])
attr.SetReadOnly()
self.SetAttr(i + 1, j + 1, attr)
Solution 1:
#attr = wx.grid.GridCellAttr() #Modify the part
for i in range(len(list1)):
attr = wx.grid.GridCellAttr()#Modify the part
self.SetCellValue(i + 1, j + 1, list1[i][j])
attr.SetReadOnly()
self.SetAttr(i + 1, j + 1, attr)
Solution 2:
attr = wx.grid.GridCellAttr()
for j in range(len(list1[i])):
self.SetCellValue(i + 1, j + 1, list1[i][j])
attr.SetReadOnly()
atttr.IncRef()#Modify the part;this will leak the GridCellAttr, because the destructor is not called
self.SetAttr(i + 1, j + 1, attr)
Read More:
- [Solved] Grid Search Error (GridSearchCV): ‘ascii‘ codec can‘t encode characters in position 18-20: ordinal not in r
- Solve the problem of error reporting from scipy.misc import imread & imresize in Python
- Collection and solution of error reporting on various platforms of pyspider
- [Exception]’ascii’ codec can’t decode byte 0xe8 in position 2: ordinal not in range(128)
- Panda error in modifying line name index does not support mutable operations
- [Solved] Error “incorrect padding” in decoding of Base64 module in Python
- Gensim Error: AttributeError: The vocab attribute was removed from KeyedVector in Gensim 4.0.0.
- Django CSV file Error: UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xb5 in position 0: invalid start
- Typeerror in Python regular expression: expected string or bytes like object
- python2.7 ExcelWriter error Exception caught in workbook destructor. Explicit close() may be require
- Parallel processing in Python (Pool.map(), Pool.starmap(), Pool.apply ())
- The range of Chinese Unicode encoding and the calculation of the number of Chinese and English words in text
- How to Fix keyerror in Python dictionary lookup
- Python: How to Reshape the data in Pandas DataFrame
- [Solved] SyntaxError: (unicode error) ‘utf-8’ codec can’t decode byte 0xbe in position 0
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- [Solved] PyTorch Caught RuntimeError in DataLoader worker process 0和invalid argument 0: Sizes of tensors mus
- [Solved] error in REfO setup command: use_2to3 is invalid.
- [Solved] pip Fatal error in launcher: Unable to create process using