Jan-27-2017, 09:00 PM
How may I handle this error message?
The PyAssertionError appears when I try to set values into a grid:
Then I get another error message:
And from where can I import this error so that it can be handled by try / except?
The PyAssertionError appears when I try to set values into a grid:
Error:Traceback (most recent call last):
File "...code01d.py", line 1097, in <module>
mainframe = Mainframe(None, -1, "Mainframe")
File "....code01d.py", line 372, in __init__
self.datenpanel = Datenpanel(self, wx.ID_ANY)
File "...code01d.py", line 180, in __init__
gridcontent = AZD["tiro"])
File "...code01d.py", line 287, in __init__
self.grid.SetCellValue(1, dyn, dystri)
File "...wx-2.8-msw-unicode\wx\grid.py", line 1880, in SetCellValue
return _grid.Grid_SetCellValue(*args, **kwargs)
PyAssertionError: C++ assertion "(row < GetNumberRows()) && (col < GetNumberCols())" failed at ..\..\src\generic\grid.cpp(3516) in wxGridStringTable::SetValue(): invalid row or column index in wxGridStringTable
So I tried to make a try / except statement:try: self.grid.SetCellValue(1, dyn, dystri) except PyAssertionError: print "wrong row or column"
Then I get another error message:
Error:Traceback (most recent call last):
File "...code01d.py", line 1096, in <module>
mainframe = Mainframe(None, -1, "Mainframe")
File "...code01d.py", line 371, in __init__
self.datenpanel = Datenpanel(self, wx.ID_ANY)
File "...code01d.py", line 180, in __init__
gridcontent = AZD["tiro"])
File "...code01d.py", line 289, in __init__
except PyAssertionError:
NameError: global name 'PyAssertionError' is not defined
But I got it a moment before as error name... how is this possible?And from where can I import this error so that it can be handled by try / except?