weird error in 2.7

I’m was running the latest 20060712 build and I get these weird errors:

Traceback (most recent call last):
File “cmsaccess.py”, line 282, in OnDragOver
r = wx.Rect(3,3,165,149)
File “C:\Python24\Lib\site-packages\wx-
2.7.0-msw-unicode\wx_core.py”, line 1111, in init
core.Rect_swiginit(self,core.new_Rect(*args, **kwargs))
PyAssertionError: C++ assertion “wxAssertFailure” failed at …\src\msw\ole\droptgt.cpp(542) in ConvertDragResultToEffect(): invalid value in ConvertDragResultToEffect

the errors are not present in 2.6 and I cannot imagine what happens… after all it looks like it fails at the creation of a simple rectangle…

Peter.

···


There is NO FATE, we are the creators.

Peter Damoc wrote:

I'm was running the latest 20060712 build and I get these weird errors:

Traceback (most recent call last):
  File "cmsaccess.py", line 282, in OnDragOver
    r = wx.Rect(3,3,165,149)
  File "C:\Python24\Lib\site-packages\wx- 2.7.0-msw-unicode\wx\_core.py", line 1111, in __init__
    _core_.Rect_swiginit(self,_core_.new_Rect(*args, **kwargs))
PyAssertionError: C++ assertion "wxAssertFailure" failed at ..\..\src\msw\ole\droptgt.cpp(542) in ConvertDragResultToEffect(): invalid value in ConvertDragResultToEffect

the errors are not present in 2.6 and I cannot imagine what happens... after all it looks like it fails at the creation of a simple rectangle...

Please try the new build. I didn't see anything like that happening. BTW, when an assertion happens in the C++ code normally it is raised as a Python exception when control returns to the Python code, but in rare cases if some other piece of Python gets called due to some event or callback and then it calls wx, then the exception can get triggered at that point in time. That is probably what is happening in this case.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Robin,

Unfortunately the error appears in 20060902 too.
I’ve tried to isolate it in a small sample.
The attached code depends on PIL
To reproduce the error try dragging one of the images from the left thumbnail browser to one of the placeholders on the right.

If you drag it fast enough the error would not appear BUT if you drag it slow enough or if you try to drag it over the lower gray part… it should throw the exceptions. It might be something wrong in my code but… it works in 2.6 :slight_smile:

Thank you in advance.

Peter

debug.zip (14.1 KB)

···

On 9/3/06, Robin Dunn robin@alldunn.com wrote:

Please try the new build. I didn’t see anything like that happening.
BTW, when an assertion happens in the C++ code normally it is raised as
a Python exception when control returns to the Python code, but in rare

cases if some other piece of Python gets called due to some event or
callback and then it calls wx, then the exception can get triggered at
that point in time. That is probably what is happening in this case.


There is NO FATE, we are the creators.

Peter Damoc wrote:

Hi Robin,

Unfortunately the error appears in 20060902 too.
I've tried to isolate it in a small sample.
The attached code depends on PIL
To reproduce the error try dragging one of the images from the left thumbnail browser to one of the placeholders on the right.
If you drag it fast enough the error would not appear BUT if you drag it slow enough or if you try to drag it over the lower gray part... it should throw the exceptions. It might be something wrong in my code but... it works in 2.6 :slight_smile:

Your DropTarget has a code path that doesn't return a drag result:

     def OnDragOver(self, x, y, ref):
         try:
             r = wx.Rect(3,3,165,148)
             if r.InsideXY(x, y):
                 i = ((y-3)/76)*3+(x-3)/55
                 # print x, y, i
                 if self.parent.highlight != i:
                     self.parent.highlight = i
                     self.parent.Refresh()
                 return wx.DragCopy
             else:
                 if self.parent.highlight != None:
                     self.parent.highlight = None
                     self.parent.Refresh()
                 return wx.DragNone # <== Add this line
         except:
             import traceback
             traceback.print_exc()
             return wx.DragError

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks Robin,

that did the trick… silly me…

Peter

···

On 9/5/06, Robin Dunn <robin@alldunn.com > wrote:

Your DropTarget has a code path that doesn’t return a drag result:


There is NO FATE, we are the creators.