Hey,
I am new to GUI based programing.
I have run into an BUG
here’s the trace back for the BUG
Traceback (most recent call last):
File “C:\Python27\lib\threading.py”, line 810, in __bootstrap_inner
self.run()
File “S:\personal\SubDown\Process.py”, line 145, in run
module1.pushData(list_Data,self.session_token)
File “S:\personal\SubDown\ListCtrl.py”, line 149, in pushData
win.newData(list_Data,session_token)
File “S:\personal\SubDown\ListCtrl.py”, line 75, in newData
self.PopulateList()
File “S:\personal\SubDown\ListCtrl.py”, line 92, in PopulateList
index = self.list.InsertStringItem(sys.maxint,str(data[1]))
File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_controls.py”, line 4713, in
InsertStringItem
return controls.ListCtrl_InsertStringItem(*args, **kwargs)
PyAssertionError: C++ assertion “m_count == ListView_GetItemCount(GetHwnd())” fa
iled at …\src\msw\listctrl.cpp(1726) in wxListCtrl::InsertItem(): m_count sh
ould match ListView_GetItemCount
could Some one help me explain what this error means?
Regards,
Sainyam Kapoor
It means something went wrong somewhere. In this case, item counts don’t match for whatever reason.
Usually on a pretty bad note that needs a fix or your code might have done this also.
The traces coming from the C++ side are usually pretty explanitory as to what is going wrong.
By your vague trace I can’t come up with a guess other than this.
What version of wxPython 3.0 are you using? I see you are using Windows. Are you using the preview build?
If you are not using the preview build found here:
http://wxpython.kosoftworks.com/preview/20140104/
then upgrade to that first and see if that doesn’t fix things.
If your trace still occurs using the newer build, then it is either a wx/wxPy bug or a bug in your code,
but without any other info or sample that reproduces this, then it is a bit hard to figure out exactly where
things went sour.
Meads that in your code you are trying to insert a string at position 65535 or more - I very much doubt that your list is that long. Note if you are trying to add to the list you should Append to it not insert it at a ridiculously high number.
Gadget/Steve
···
On 15/05/14 23:39, sainyam kapoor wrote:
File "S:\personal\SubDown\ListCtrl.py", line 92, in PopulateList
index = self.list.InsertStringItem(sys.maxint,str(data[1]))
Those particular def names came from the wxPy demo, but that shouldn’t have caused that particular trace, normally, it sees that as the last possible insertion point or (Append).
But yes, Append is more descriptive as to what the intended position wanted is.
The demo also had quite a few of these nasty errors with the original 3.0 build, compiled issues and other odd stuff with certain widgets that the preview build fixed. (The demo wouldn’t even fire up without removing the searchctrl),
which is why I believe the problem arised(plus reporter claims to be new so go figure, grabed the standard borked build from the main wxPy page probably unknowingly)
But yes, when writing new code, the Append method will do the exact same thing and is more readable anyway.
Not sure why that was written that way for the ListCtrl demo(besides maybe being another way to do the same thing), but it would be interesting to timeit benchmark it against the Append method with a nice long list.
···
On Friday, May 16, 2014 1:41:10 AM UTC-6, Gadget Steve wrote:
On 15/05/14 23:39, sainyam kapoor wrote:
File “S:\personal\SubDown\ListCtrl.py”, line 92, in PopulateList
index = self.list.InsertStringItem(sys.maxint,str(data[1]))
Meads that in your code you are trying to insert a string at position
65535 or more - I very much doubt that your list is that long. Note if
you are trying to add to the list you should Append to it not insert it
at a ridiculously high number.
Gadget/Steve
I have found, in the process of getting an existing code base using
python 2.5.4 and an older wxPython to run with python 2.7 and recent
wxPython builds that there are a number of practices that were
allowed, or even standard, some of them used in the (older) demo
event, that the C++ base wxWidgets has added a number of asserts
where code that worked perfectly on the old build did not with the
recent. This is the typical sort of thing - interestingly when I
get things working on the new build it still works perfectly on the
old so I guess that the wxWidgets guys have tightened the rules on
some questionable behaviour, e.g.:
assert m_count == ListView_GetItemCount(GetHwnd()) rather than or (hopefully) as well as:
if m_count >= ListView_GetItemCount(GetHwnd()) append(item)
The reason I say hopefully is that if the code asserts instead of
asserts then tries to cope then it may fail badly at runtime in
non-debug builds. Personally I don’t like asserts as unless you can
guarantee 100% testing with your debug build your code you are
leaving bugs that someone knew enough about to put in the assert but
did not care enough to fail cleanly or cope with.
Gadget/Steve
···
On 16/05/14 09:40, Metallicow wrote:
On Friday, May 16, 2014 1:41:10 AM UTC-6, Gadget Steve wrote:
On
15/05/14 23:39, sainyam kapoor wrote:
> File "S:\personal\SubDown\ListCtrl. py", line 92, in
PopulateList
> index = self.list.InsertStringItem( sys.maxint,str(data[1]))
Meads that in your code you are trying to insert a string at
position
65535 or more - I very much doubt that your list is that long.
Note if
you are trying to add to the list you should Append to it not
insert it
at a ridiculously high number.
Gadget/Steve
Those particular def names came from the wxPy demo, but that
shouldn’t have caused that particular trace, normally, it sees
that as the last possible insertion point or (Append).
But yes, Append is more descriptive as to what the intended
position wanted is.
The demo also had quite a few of these nasty errors with the
original 3.0 build, compiled issues and other odd stuff with
certain widgets that the preview build fixed. (The demo
wouldn’t even fire up without removing the searchctrl),
which is why I believe the problem arised(plus reporter claims
to be new so go figure, grabed the standard borked build from
the main wxPy page probably unknowingly)
But yes, when writing new code, the Append method will do the
exact same thing and is more readable anyway.
Not sure why that was written that way for the ListCtrl
demo(besides maybe being another way to do the same thing),
but it would be interesting to timeit benchmark it against the
Append method with a nice long list.
–
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](https://groups.google.com/d/optout).