PyAssertionErrors - possibly due to changes in screen resolution?

Hi All,

it’s been a while since I posted on this list :slight_smile: . In our main application - which still uses wxPython 2.9.4 Classic, Python 2.7 64 bit on Windows 7, sometimes we see these cryptic messages coming up to our error handlers:

Traceback (most recent call last):

File C:\Python27\lib\site-packages\wx-2.9.4-msw\wx\lib\stattext.py, line 84, in DoGetBestSize

label = self.GetLabel()

File C:\Python27\lib\site-packages\wx-2.9.4-msw\wx_core.py, line 9232, in GetLabel

return core.Window_GetLabel(*args, **kwargs)

PyAssertionError: C++ assertion idx < m_size failed at C:\BUILD\wxPython-src-2.9.4.0\include\wx/vector.h(319) in wxVector::at():

It’s not always stattext.py - it can be AUI panes, a simple wx.TextCtrl or a wx.ListCtrl and so on. It seems kind of random where it happens, but it definitely happens when we remotely log on on our workstations from different machines multiple times via Citrix.

It might be an issue of different screen resolutions on those machines used to access the remote workstation, and anyway the error message is harmless as everything works all right in our application once we dismiss our custom error dialog that handles unexpected exceptions in our code.

In any case, it’s annoying for this message to appear in the first place, especially because it’s not due to our code but to something in the wxWidgets machinery…

I was thinking of trying to suppress these messages with something like:

wx.GetApp().SetAssertMode(wx.PYAPP_ASSERT_SUPPRESS)

But I have no clue whether this is going to work (it takes a veeeeery long time to reproduce that traceback above) and if it is going to hide other - more important - assertion errors due to our code.

Am I thinking in the right way? Any suggestion?

Thank you in advance.

Andrea.

Hi Andrea,

At least in the current code I don’t see how it can get from GetLabel to the vector code. So my guess is that the problem is happening elsewhere, but the call to GetLabel (or whatever in the other cases) is the first time after the problem that there is a transition back to Python from C++ and so that is when the Python exception is raised. I suggest looking at other things that may be happening around the same time or just before the exception happens. Perhaps there is a wx.Yield or something that allows pending events to be processed, which lets the event handler where the exception is raised to be called before control returns to the original event handler that actually caused the problem.

You’re right that suppressing the assertions would avoid getting this error, but it may hide others that are more important.

···

Robin

On Friday, March 16, 2018 at 1:06:07 AM UTC-7, Infinity77 wrote:

Hi All,

it’s been a while since I posted on this list :slight_smile: . In our main application - which still uses wxPython 2.9.4 Classic, Python 2.7 64 bit on Windows 7, sometimes we see these cryptic messages coming up to our error handlers:

Traceback (most recent call last):

File C:\Python27\lib\site-packages\wx-2.9.4-msw\wx\lib\stattext.py, line 84, in DoGetBestSize

label = self.GetLabel()

File C:\Python27\lib\site-packages\wx-2.9.4-msw\wx_core.py, line 9232, in GetLabel

return core.Window_GetLabel(*args, **kwargs)

PyAssertionError: C++ assertion idx < m_size failed at C:\BUILD\wxPython-src-2.9.4.0\include\wx/vector.h(319) in wxVector::at():

It’s not always stattext.py - it can be AUI panes, a simple wx.TextCtrl or a wx.ListCtrl and so on. It seems kind of random where it happens, but it definitely happens when we remotely log on on our workstations from different machines multiple times via Citrix.

It might be an issue of different screen resolutions on those machines used to access the remote workstation, and anyway the error message is harmless as everything works all right in our application once we dismiss our custom error dialog that handles unexpected exceptions in our code.

In any case, it’s annoying for this message to appear in the first place, especially because it’s not due to our code but to something in the wxWidgets machinery…

I was thinking of trying to suppress these messages with something like:

wx.GetApp().SetAssertMode(wx.PYAPP_ASSERT_SUPPRESS)

But I have no clue whether this is going to work (it takes a veeeeery long time to reproduce that traceback above) and if it is going to hide other - more important - assertion errors due to our code.

Am I thinking in the right way? Any suggestion?

Thank you in advance.

Andrea.

Hi Robin,

Hi Andrea,

At least in the current code I don’t see how it can get from GetLabel to the vector code. So my guess is that the problem is happening elsewhere, but the call to GetLabel (or whatever in the other cases) is the first time after the problem that there is a transition back to Python from C++ and so that is when the Python exception is raised. I suggest looking at other things that may be happening around the same time or just before the exception happens. Perhaps there is a wx.Yield or something that allows pending events to be processed, which lets the event handler where the exception is raised to be called before control returns to the original event handler that actually caused the problem.

You’re right that suppressing the assertions would avoid getting this error, but it may hide others that are more important.

Thank you for the suggestions. It’s not going to be easy to track it down though, looking at 80,000 lines of code and try to divine where it may come from… and it’s not an easy assertion to trigger, sometimes it takes hours and multiple connections/disconnections to get it.

I don’t even know where wxVector may be called from…

Andrea.

···

On Fri, 16 Mar 2018 at 19.49, Robin Dunn robin@alldunn.com wrote:

Robin

On Friday, March 16, 2018 at 1:06:07 AM UTC-7, Infinity77 wrote:

Hi All,

it’s been a while since I posted on this list :slight_smile: . In our main application - which still uses wxPython 2.9.4 Classic, Python 2.7 64 bit on Windows 7, sometimes we see these cryptic messages coming up to our error handlers:

Traceback (most recent call last):

File C:\Python27\lib\site-packages\wx-2.9.4-msw\wx\lib\stattext.py, line 84, in DoGetBestSize

label = self.GetLabel()

File C:\Python27\lib\site-packages\wx-2.9.4-msw\wx_core.py, line 9232, in GetLabel

return core.Window_GetLabel(*args, **kwargs)

PyAssertionError: C++ assertion idx < m_size failed at C:\BUILD\wxPython-src-2.9.4.0\include\wx/vector.h(319) in wxVector::at():

It’s not always stattext.py - it can be AUI panes, a simple wx.TextCtrl or a wx.ListCtrl and so on. It seems kind of random where it happens, but it definitely happens when we remotely log on on our workstations from different machines multiple times via Citrix.

It might be an issue of different screen resolutions on those machines used to access the remote workstation, and anyway the error message is harmless as everything works all right in our application once we dismiss our custom error dialog that handles unexpected exceptions in our code.

In any case, it’s annoying for this message to appear in the first place, especially because it’s not due to our code but to something in the wxWidgets machinery…

I was thinking of trying to suppress these messages with something like:

wx.GetApp().SetAssertMode(wx.PYAPP_ASSERT_SUPPRESS)

But I have no clue whether this is going to work (it takes a veeeeery long time to reproduce that traceback above) and if it is going to hide other - more important - assertion errors due to our code.

Am I thinking in the right way? Any suggestion?

Thank you in advance.

Andrea.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.