Problem/difference with ListCtrl in 3.0?

Good Morning,

I’ve been developing on wxPython version 2.8 for awhile, and have a application developed and tested that works for that version.

This morning, I installed wxPython 3.0 for a colleague and gave him the application. When my program tried to Insert an item to a ListCtrl item, the following error is produced:

Traceback (most recent call last):

File “Program.py”, line 305, in Function

self.box.InsertItem(item)

File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_controls.py”, line 4709, in InsertItem

return controls.ListCtrl_InsertItem(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “rv != -1” failed at …\src\msw\listctrl.cpp(1722) in wxListCtrl::InsertItem(): failed to insert an item in wxListCtrl

I ended up uninstalling 3.0 and installing 2.8 for him. However, I’m curious… is this a feature or a bug of 3.0?

Thanks,

Austin Grelle

Not surprisingly, we can’t tell a thing without seeing your code.
It’s possible your application is relying on a feature or on code
ordering that was never anticipated or never documented. No one is
claiming wxPython 3.0 is perfect, but remember that just because an
application works does not necessarily mean it is correct.

···

Austin Grelle wrote:

      I've

been developing on wxPython version 2.8 for awhile, and have a
application developed and tested that works for that version.

      This

morning, I installed wxPython 3.0 for a colleague and gave him
the application. When my program tried to Insert an item to a
ListCtrl item, the following error is produced:

Traceback (most recent call last):

File “Program.py”, line 305, in Function

self.box.InsertItem(item)

        File

“C:\Python27\lib\site-packages\wx-3.0-msw\wx_controls.py”,
line 4709, in InsertItem

        return _controls_.ListCtrl_InsertItem(*args,

**kwargs)

        wx._core.PyAssertionError: C++ assertion "rv != -1"

failed at …..\src\msw\listctrl.cpp(1722) in
wxListCtrl::InsertItem(): failed to insert an item in
wxListCtrl

      I

ended up uninstalling 3.0 and installing 2.8 for him. However,
I’m curious… is this a feature or a bug of 3.0?

-- Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com

FWIW I just tried my ListBox program with 3.0 and Append works for an object that is a subclass of wx.ListCtrl, listmix.ListCtrlAutoWidthMixin

···

On Tuesday, June 17, 2014 8:08:43 AM UTC-7, Austin Grelle wrote:

Good Morning,

I’ve been developing on wxPython version 2.8 for awhile, and have a application developed and tested that works for that version.

This morning, I installed wxPython 3.0 for a colleague and gave him the application. When my program tried to Insert an item to a ListCtrl item, the following error is produced:

Traceback (most recent call last):

File “Program.py”, line 305, in Function

self.box.InsertItem(item)

File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_controls.py”, line 4709, in InsertItem

return controls.ListCtrl_InsertItem(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “rv != -1” failed at …..\src\msw\listctrl.cpp(1722) in wxListCtrl::InsertItem(): failed to insert an item in wxListCtrl

I ended up uninstalling 3.0 and installing 2.8 for him. However, I’m curious… is this a feature or a bug of 3.0?

Thanks,

Austin Grelle

Thanks for the reply. This error occurred using wx.ListCtrl (wxPython API Documentation — wxPython Phoenix 4.2.2 documentation ), I’m not sure if it will affect the ListBox.

···

On Tuesday, June 17, 2014 2:56:06 PM UTC-5, Nathan McCorkle wrote:

FWIW I just tried my ListBox program with 3.0 and Append works for an object that is a subclass of wx.ListCtrl, listmix.ListCtrlAutoWidthMixin

On Tuesday, June 17, 2014 8:08:43 AM UTC-7, Austin Grelle wrote:

Good Morning,

I’ve been developing on wxPython version 2.8 for awhile, and have a application developed and tested that works for that version.

This morning, I installed wxPython 3.0 for a colleague and gave him the application. When my program tried to Insert an item to a ListCtrl item, the following error is produced:

Traceback (most recent call last):

File “Program.py”, line 305, in Function

self.box.InsertItem(item)

File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_controls.py”, line 4709, in InsertItem

return controls.ListCtrl_InsertItem(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “rv != -1” failed at …..\src\msw\listctrl.cpp(1722) in wxListCtrl::InsertItem(): failed to insert an item in wxListCtrl

I ended up uninstalling 3.0 and installing 2.8 for him. However, I’m curious… is this a feature or a bug of 3.0?

Thanks,

Austin Grelle

Thanks for the reply Tim.

Here is some more detail and code:

Creation of the PINC1box ListCtrl

Create the top of the PINC panel for ‘Populated’ PINCs

self.panelPINC1 = wx.Panel(self.panelRight)

PINC1sizer = wx.BoxSizer(wx.VERTICAL)

self.PINC1text = wx.StaticText(self.panelPINC1, label = “Selected PINCs for viewing:”)

self.PINC1box = wx.ListCtrl(self.panelPINC1)

self.PINC1box.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)

self.PINC1box.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeSelected)

Action taken on the click of the “Add All” button

def OnAddAllPINCs(self, event):

x = self.PINCs

x.reverse()

for name in x:

if name not in self.addedPINCS and (name.count(“-”) <= 2):

item = wx.ListItem()

item.SetText(name)

self.listPINCS.append(item)

self.addedPINCS.append(name)

self.PINC1box.InsertItem(item)

At the onset of the function OnAddAllPINCs, self.PINCs is a list with contents:

[‘----- G - General -----’, ‘G-100’, ‘G-101’, ‘G-110’, ‘G-111’, ‘G-112’, ‘G-113’, ‘G-114’, ‘G-115’, ‘G-116’, ‘G-117’, ‘G-131’, ‘G-132’, ‘G-150’, ‘G-152’, ‘G-153’, ‘G-155’, ‘G-156’, ‘G-250’, ‘G-251’, ‘G-253’, ‘G-300’, ‘G-301’, ‘G-302’, ‘G-303’, ‘G-304’, ‘G-305’, ‘G-306’, ‘G-309’, ‘G-310’, ‘G-311’, ‘G-312’, ‘G-313’, ‘G-314’, ‘G-315’, ‘G-316’, ‘G-317’, ‘G-801’, ‘G-802’, ‘G-803’, ‘G-808’, ‘G-809’, ‘G-811’, ‘G-821’, ‘G-822’, ‘G-823’, ‘G-831’, ‘G-832’, ‘G-833’, ‘G-841’, ‘G-842’, ‘G-843’, ‘G-844’, ‘G-845’, ‘G-846’, ‘G-847’, ‘G-848’, ‘G-849’, ‘G-850’, ‘G-851’, ‘G-852’, ‘G-854’, ‘G-855’, ‘G-856’, ‘G-857’, ‘G-858’, ‘G-859’, ‘G-860’, ‘G-861’, ‘G-862’, ‘G-863’, ‘G-864’, ‘G-865’, ‘G-881’, ‘G-882’, ‘G-891’, ‘G-892’, ‘G-900’, ‘----- E - Pollution -----’, ‘E-100’, ‘E-101’, ‘E-102’, ‘E-103’, ‘E-104’, ‘E-105’, ‘E-106’, ‘E-107’, ‘E-108’, ‘E-120’, ‘E-123’, ‘E-200’, ‘E-201’, ‘E-202’, ‘E-801’, ‘E-802’, ‘E-821’, ‘E-822’, ‘E-831’, ‘E-832’, ‘E-833’, ‘E-841’, ‘E-842’, ‘----- D - Drilling -----’, ‘D-100’, ‘D-101’, ‘D-110’, ‘D-111’, ‘D-112’, ‘D-113’, ‘D-120’, ‘D-121’, ‘D-130’, ‘D-150’, ‘D-151’, ‘D-152’, ‘D-153’, ‘D-154’, ‘D-155’, ‘D-156’, ‘D-157’, ‘D-158’, ‘D-159’, ‘D-160’, ‘D-161’, ‘D-163’, ‘D-164’, ‘D-165’, ‘D-166’, ‘D-167’, ‘D-168’, ‘D-169’, ‘D-170’, ‘D-171’, ‘D-172’, ‘D-173’, ‘D-174’, ‘D-175’, ‘D-176’, ‘D-177’, ‘D-178’, ‘D-179’, ‘D-200’, ‘D-201’, ‘D-202’, ‘D-203’, ‘D-204’, ‘D-205’, ‘D-207’, ‘D-208’, ‘D-209’, ‘D-210’, ‘D-211’, ‘D-212’, ‘D-213’, ‘D-214’, ‘D-215’, ‘D-216’, ‘D-217’, ‘D-218’, ‘D-219’, ‘D-220’, ‘D-221’, ‘D-222’, ‘D-223’, ‘D-224’, ‘D-225’, ‘D-226’, ‘D-227’, ‘D-231’, ‘D-232’, ‘D-240’, ‘D-241’, ‘D-242’, ‘D-243’, ‘D-244’, ‘D-245’, ‘D-246’, ‘D-247’, ‘D-248’, ‘D-249’, ‘D-250’, ‘D-251’, ‘D-252’, ‘D-253’, ‘D-254’, ‘D-256’, ‘D-257’, ‘D-258’, ‘D-259’, ‘D-260’, ‘D-261’, ‘D-262’, ‘D-263’, ‘D-264’, ‘D-265’, ‘D-266’, ‘D-267’, ‘D-268’, ‘D-269’, ‘D-270’, ‘D-271’, ‘D-272’, ‘D-273’, ‘D-274’, ‘D-281’, ‘D-282’, ‘D-283’, ‘D-285’, ‘D-290’, ‘D-291’, ‘D-292’, ‘D-300’, ‘D-301’, ‘D-302’, ‘D-305’, ‘D-306’, ‘D-307’, ‘D-308’, ‘D-309’, ‘D-311’, ‘D-312’, ‘D-313’, ‘D-314’, ‘D-315’, ‘D-316’, ‘D-317’, ‘D-322’, ‘D-324’, ‘D-326’, ‘D-327’, ‘D-334’, ‘D-400’, ‘D-401’, ‘D-402’, ‘D-403’, ‘D-404’, ‘D-405’, ‘D-406’, ‘D-407’, ‘D-408’, ‘D-410’, ‘D-411’, ‘D-412’, ‘D-413’, ‘D-414’, ‘D-415’, ‘D-416’, ‘D-421’, ‘D-422’, ‘D-423’, ‘D-424’, ‘D-425’, ‘D-426’, ‘D-427’, ‘D-428’, ‘D-429’, ‘D-440’, ‘D-450’, ‘D-453’, ‘D-460’, ‘D-461’, ‘D-462’, ‘D-463’, ‘D-500’, ‘D-501’, ‘D-502’, ‘D-503’, ‘D-504’, ‘D-600’, ‘D-601’, ‘D-602’, ‘D-603’, ‘D-604’, ‘D-610’, ‘D-611’, ‘D-612’, ‘D-613’, ‘D-801’, ‘D-802’, ‘D-803’, ‘D-821’, ‘D-822’, ‘D-831’, ‘D-841’, ‘----- C - Completion -----’, ‘C-100’, ‘C-101’, ‘C-102’, ‘C-104’, ‘C-105’, ‘C-106’, ‘C-107’, ‘C-108’, ‘C-109’, ‘C-110’, ‘C-111’, ‘C-112’, ‘C-113’, ‘C-114’, ‘C-115’, ‘C-116’, ‘C-117’, ‘C-118’, ‘C-119’, ‘C-120’, ‘C-121’, ‘C-122’, ‘C-123’, ‘C-124’, ‘C-125’, ‘C-126’, ‘C-127’, ‘C-128’, ‘C-129’, ‘C-130’, ‘C-131’, ‘C-132’, ‘C-133’, ‘C-134’, ‘C-135’, ‘C-136’, ‘C-137’, ‘C-138’, ‘C-139’, ‘C-140’, ‘C-141’, ‘C-142’, ‘C-143’, ‘C-144’, ‘C-145’, ‘C-146’, ‘C-147’, ‘C-148’, ‘C-149’, ‘C-150’, ‘C-151’, ‘C-152’, ‘C-153’, ‘C-154’, ‘C-155’, ‘C-156’, ‘C-160’, ‘C-170’, ‘C-171’, ‘C-172’, ‘C-173’, ‘C-174’, ‘C-175’, ‘C-176’, ‘C-177’, ‘C-178’, ‘C-179’, ‘C-180’, ‘C-191’, ‘C-182’, ‘C-183’, ‘C-184’, ‘C-185’, ‘C-186’, ‘C-187’, ‘C-188’, ‘C-189’, ‘C-190’, ‘C-191’, ‘C-801’, ‘----- W - Workover -----’, ‘W-100’, ‘W-101’, ‘W-102’, ‘W-104’, ‘W-105’, ‘W-106’, ‘W-107’, ‘W-108’, ‘W-109’, ‘W-110’, ‘W-111’, ‘W-112’, ‘W-113’, ‘W-114’, ‘W-115’, ‘W-116’, ‘W-117’, ‘W-118’, ‘W-119’, ‘W-120’, ‘W-121’, ‘W-122’, ‘W-123’, ‘W-124’, ‘W-125’, ‘W-126’, ‘W-127’, ‘W-128’, ‘W-129’, ‘W-130’, ‘W-131’, ‘W-132’, ‘W-133’, ‘W-134’, ‘W-135’, ‘W-136’, ‘W-137’, ‘W-138’, ‘W-139’, ‘W-140’, ‘W-141’, ‘W-142’, ‘W-143’, ‘W-144’, ‘W-145’, ‘W-146’, ‘W-147’, ‘W-148’, ‘W-149’, ‘W-150’, ‘W-151’, ‘W-152’, ‘W-153’, ‘W-154’, ‘W-155’, ‘W-156’, ‘W-157’, ‘W-158’, ‘W-159’, ‘W-160’, ‘W-161’, ‘W-162’, ‘W-163’, ‘W-170’, ‘W-171’, ‘W-172’, ‘W-180’, ‘W-190’, ‘W-191’, ‘W-192’, ‘W-193’, ‘W-194’, ‘W-195’, ‘W-196’, ‘W-197’, ‘W-198’, ‘W-199’, ‘W-200’, ‘W-201’, ‘W-202’, ‘W-203’, ‘W-204’, ‘W-205’, ‘W-206’, ‘W-207’, ‘W-208’, ‘W-209’, ‘W-210’, ‘W-211’, ‘W-212’, ‘W-213’, ‘W-801’, ‘----- A - Decommissioning -----’, ‘A-100’, ‘A-101’, ‘A-102’, ‘A-103’, ‘A-104’, ‘A-105’, ‘A-107’, ‘A-108’, ‘A-109’, ‘A-110’, ‘A-111’, ‘A-114’, ‘A-117’, ‘A-121’, ‘A-122’, ‘A-123’, ‘A-124’, ‘A-125’, ‘A-126’, ‘A-127’, ‘A-128’, ‘A-129’, ‘A-130’, ‘A-131’, ‘A-132’, ‘A-133’, ‘A-134’, ‘A-135’, ‘A-136’, ‘A-137’, ‘A-138’, ‘A-139’, ‘A-140’, ‘A-141’, ‘A-142’, ‘A-143’, ‘A-144’, ‘A-145’, ‘A-146’, ‘A-147’, ‘A-148’, ‘A-149’, ‘A-150’, ‘A-151’, ‘A-152’, ‘A-153’, ‘A-154’, ‘A-155’, ‘A-156’, ‘A-157’, ‘A-158’, ‘A-159’, ‘A-160’, ‘A-161’, ‘A-162’, ‘A-163’, ‘A-164’, ‘A-165’, ‘A-166’, ‘A-167’, ‘A-168’, ‘A-190’, ‘A-191’, ‘A-192’, ‘A-193’, ‘A-194’, ‘A-195’, ‘A-196’, ‘A-197’, ‘A-198’, ‘A-199’, ‘A-200’, ‘A-201’, ‘A-221’, ‘A-222’, ‘A-223’, ‘A-224’, ‘A-240’, ‘A-241’, ‘A-242’, ‘A-243’, ‘A-244’, ‘A-245’, ‘A-246’, ‘A-801’, ‘A-802’, ‘----- P - Production -----’, ‘P-100’, ‘P-101’, ‘P-102’, ‘P-103’, ‘P-105’, ‘P-107’, ‘P-108’, ‘P-109’, ‘P-110’, ‘P-111’, ‘P-112’, ‘P-113’, ‘P-114’, ‘P-120’, ‘P-130’, ‘P-131’, ‘P-132’, ‘P-133’, ‘P-150’, ‘P-153’, ‘P-154’, ‘P-155’, ‘P-170’, ‘P-173’, ‘P-175’, ‘P-176’, ‘P-177’, ‘P-200’, ‘P-201’, ‘P-202’, ‘P-203’, ‘P-204’, ‘P-205’, ‘P-206’, ‘P-207’, ‘P-208’, ‘P-209’, ‘P-231’, ‘P-232’, ‘P-233’, ‘P-234’, ‘P-235’, ‘P-237’, ‘P-238’, ‘P-239’, ‘P-240’, ‘P-241’, ‘P-242’, ‘P-243’, ‘P-260’, ‘P-261’, ‘P-262’, ‘P-263’, ‘P-264’, ‘P-265’, ‘P-267’, ‘P-268’, ‘P-269’, ‘P-270’, ‘P-271’, ‘P-280’, ‘P-281’, ‘P-283’, ‘P-284’, ‘P-300’, ‘P-301’, ‘P-302’, ‘P-303’, ‘P-304’, ‘P-305’, ‘P-307’, ‘P-308’, ‘P-309’, ‘P-310’, ‘P-311’, ‘P-312’, ‘P-313’, ‘P-314’, ‘P-315’, ‘P-316’, ‘P-317’, ‘P-320’, ‘P-340’, ‘P-341’, ‘P-342’, ‘P-343’, ‘P-344’, ‘P-361’, ‘P-362’, ‘P-364’, ‘P-380’, ‘P-381’, ‘P-402’, ‘P-404’, ‘P-405’, ‘P-406’, ‘P-407’, ‘P-408’, ‘P-410’, ‘P-412’, ‘P-413’, ‘P-414’, ‘P-415’, ‘P-416’, ‘P-417’, ‘P-418’, ‘P-422’, ‘P-423’, ‘P-424’, ‘P-426’, ‘P-427’, ‘P-428’, ‘P-429’, ‘P-430’, ‘P-431’, ‘P-433’, ‘P-434’, ‘P-451’, ‘P-452’, ‘P-470’, ‘P-471’, ‘P-472’, ‘P-474’, ‘P-475’, ‘P-520’, ‘P-521’, ‘P-522’, ‘P-523’, ‘P-524’, ‘P-525’, ‘P-526’, ‘P-527’, ‘P-528’, ‘P-529’, ‘P-530’, ‘P-531’, ‘P-532’, ‘P-533’, ‘P-540’, ‘P-541’, ‘P-542’, ‘P-550’, ‘P-551’, ‘P-562’, ‘P-563’, ‘P-567’, ‘P-569’, ‘P-570’, ‘P-571’, ‘P-572’, ‘P-573’, ‘P-574’, ‘P-576’, ‘P-801’, ‘P-802’, ‘P-803’, ‘P-804’, ‘P-805’, ‘P-806’, ‘P-807’, ‘P-808’, ‘----- L - Pipelines -----’, ‘L-102’, ‘L-103’, ‘L-104’, ‘L-106’, ‘L-107’, ‘L-108’, ‘L-109’, ‘L-112’, ‘L-113’, ‘L-114’, ‘L-121’, ‘L-124’, ‘L-125’, ‘L-126’, ‘L-127’, ‘L-140’, ‘L-141’, ‘L-142’, ‘L-143’, ‘L-801’, ‘L-802’, ‘L-803’, ‘L-804’, ‘L-811’, ‘L-812’, ‘L-813’, ‘L-821’, ‘L-822’, ‘L-823’, ‘L-831’, ‘L-832’, ‘L-833’, ‘L-834’, ‘L-835’, ‘L-841’, ‘L-851’, ‘----- M - Measurement -----’, ‘M-100’, ‘M-101’, ‘M-102’, ‘M-103’, ‘M-104’, ‘M-105’, ‘M-106’, ‘M-107’, ‘M-108’, ‘M-109’, ‘M-110’, ‘M-111’, ‘M-112’, ‘M-113’, ‘M-114’, ‘M-115’, ‘M-116’, ‘M-117’, ‘M-118’, ‘M-119’, ‘M-120’, ‘M-121’, ‘M-122’, ‘M-123’, ‘M-124’, ‘M-125’, ‘M-126’, ‘M-127’, ‘M-129’, ‘M-130’, ‘M-131’, ‘M-132’, ‘M-133’, ‘M-134’, ‘M-135’, ‘M-136’, ‘M-137’, ‘M-138’, ‘M-139’, ‘M-140’, ‘M-141’, ‘M-142’, ‘M-143’, ‘M-144’, ‘M-150’, ‘M-200’, ‘M-201’, ‘M-202’, ‘M-203’, ‘M-204’, ‘M-205’, ‘M-206’, ‘M-207’, ‘M-208’, ‘M-209’, ‘M-210’, ‘M-248’, ‘M-249’, ‘M-250’, ‘M-251’, ‘M-298’, ‘M-299’, ‘M-300’, ‘M-301’, ‘M-302’, ‘M-304’, ‘M-305’, ‘M-306’, ‘M-307’, ‘M-308’, ‘M-309’, ‘M-310’, ‘M-801’, ‘M-802’, ‘M-803’, ‘M-821’, ‘M-831’, ‘----- H - Hydrogen Sulfide -----’, ‘H-100’, ‘H-101’, ‘H-102’, ‘H-103’, ‘H-104’, ‘H-105’, ‘H-106’, ‘H-107’, ‘H-108’, ‘H-109’, ‘H-111’, ‘H-113’, ‘H-114’, ‘H-115’, ‘H-117’, ‘H-118’, ‘H-120’, ‘H-121’, ‘H-122’, ‘H-123’, ‘H-124’, ‘H-125’, ‘H-126’, ‘H-127’, ‘H-129’, ‘H-131’, ‘H-132’, ‘H-133’, ‘H-134’, ‘H-135’, ‘H-136’, ‘H-137’, ‘H-138’, ‘H-140’, ‘H-141’, ‘H-142’, ‘H-143’, ‘H-144’, ‘H-145’, ‘H-146’, ‘H-147’, ‘H-148’, ‘H-149’, ‘H-150’, ‘H-151’, ‘H-152’, ‘H-153’, ‘H-154’, ‘H-155’, ‘H-156’, ‘H-157’, ‘H-158’, ‘H-159’, ‘H-160’, ‘H-161’, ‘H-162’, ‘H-163’, ‘H-164’, ‘H-165’, ‘H-166’, ‘H-167’, ‘H-168’, ‘H-169’, ‘H-170’, ‘H-171’, ‘H-172’, ‘H-173’, ‘H-174’, ‘H-175’, ‘H-176’, ‘H-177’, ‘H-178’, ‘H-179’, ‘H-180’, ‘H-181’, ‘----- I - Crane -----’, ‘I-101’, ‘I-102’, ‘I-103’, ‘I-104’, ‘I-105’, ‘I-111’, ‘I-112’, ‘I-113’, ‘I-114’, ‘I-115’, ‘I-116’, ‘I-117’, ‘I-131’, ‘I-132’, ‘I-133’, ‘I-134’, ‘I-141’, ‘I-142’, ‘I-143’, ‘I-144’, ‘I-145’, ‘I-146’, ‘I-147’, ‘I-151’, ‘I-152’, ‘I-153’, ‘I-161’, ‘I-162’, ‘I-171’, ‘I-181’, ‘I-182’, ‘I-183’, ‘I-190’, ‘----- F - Electrical -----’, ‘F-101’, ‘F-103’, ‘F-104’, ‘F-105’, ‘F-106’, ‘F-108’, ‘F-121’, ‘F-122’, ‘F-124’, ‘F-127’, ‘F-128’, ‘F-141’, ‘F-161’, ‘----- S - SEMS -----’, ‘S-001’, ‘S-002’, ‘S-102’, ‘S-103’, ‘S-104’, ‘S-105’, ‘----- Z - Personal Safety, 33 -----’, ‘Z-100’, ‘Z-102’, ‘Z-104’, ‘Z-106’, ‘Z-108’, ‘Z-110’, ‘Z-112’, ‘Z-114’, ‘Z-120’, ‘Z-125’, ‘Z-130’, ‘Z-135’, ‘Z-140’, ‘Z-145’, ‘Z-150’, ‘Z-155’, ‘Z-160’, ‘Z-165’, ‘Z-170’, ‘Z-175’, ‘Z-180’, ‘Z-185’, ‘Z-190’, ‘Z-195’, ‘Z-200’, ‘Z-205’, ‘Z-210’, ‘----- R - Conservation -----’, ‘R-801’, ‘R-802’, ‘R-803’, ‘R-804’, ‘R-811’, ‘R-812’, ‘R-813’, ‘R-821’, ‘R-822’, ‘R-823’, ‘R-831’, ‘R-832’, ‘R-833’, ‘R-840’, ‘R-841’, ‘R-842’, ‘R-843’, ‘R-844’, ‘R-845’, ‘R-850’, ‘R-851’, ‘----- O - Geological -----’, ‘O-801’, ‘O-802’, ‘O-803’, ‘O-804’, ‘O-811’, ‘O-812’, ‘----- T - Renewable Energy -----’, ‘T-800’, ‘T-801’, ‘T-802’, ‘T-803’, ‘T-804’, ‘T-805’, ‘T-806’, ‘T-807’, ‘T-808’, ‘T-809’, ‘T-810’, ‘T-811’, ‘T-812’, ‘T-813’, ‘T-814’, ‘T-815’, ‘T-816’, ‘T-817’, ‘T-818’, ‘T-819’, ‘T-820’, ‘T-821’, ‘T-822’, ‘T-823’, ‘T-824’, ‘T-825’, ‘T-826’, ‘T-827’, ‘T-828’, ‘T-829’, ‘T-830’, ‘T-831’, ‘T-832’, ‘T-833’, ‘T-834’, ‘T-835’, ‘T-836’, ‘T-837’, ‘T-838’]

**The ‘for’ loop then begins in the function OnAddAllPINCs(), and the first iteration the variable ‘name’ is a string of value: **

‘T-838’

a ListItem is successfully created on the line: item = wx.ListItem(), and the item’s text is set to ‘T-838’

The program then throws the exception at the line self.PINC1box.InsertItem(item)

Traceback (most recent call last):

File “P:\My Documents\Projects\BSEE\Automation\Data_Tool\Program\CFRviewer.py”, line 307, in OnAddAllPINCs

self.PINC1box.InsertItem(item)

File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_controls.py”, line 4709, in InsertItem

return controls.ListCtrl_InsertItem(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “rv != -1” failed at …..\src\msw\listctrl.cpp(1722) in wxListCtrl::InsertItem(): failed to insert an item in wxListCtrl

Again, no problems running this with 2.8.12.1 (msw-unicode), however the error happens on 3.0.0.0 msw (classic)

···

On Tuesday, June 17, 2014 1:05:38 PM UTC-5, Tim Roberts wrote:

Austin Grelle wrote:

      I've

been developing on wxPython version 2.8 for awhile, and have a
application developed and tested that works for that version.

      This

morning, I installed wxPython 3.0 for a colleague and gave him
the application. When my program tried to Insert an item to a
ListCtrl item, the following error is produced:

Traceback (most recent call last):

File “Program.py”, line 305, in Function

self.box.InsertItem(item)

        File

“C:\Python27\lib\site-packages\wx-3.0-msw\wx_ controls.py”,
line 4709, in InsertItem

return controls.ListCtrl_ InsertItem(*args,
**kwargs)

        wx._core.PyAssertionError: C++ assertion "rv != -1"

failed at …..\src\msw\listctrl.cpp( 1722) in
wxListCtrl::InsertItem(): failed to insert an item in
wxListCtrl

      I

ended up uninstalling 3.0 and installing 2.8 for him. However,
I’m curious… is this a feature or a bug of 3.0?

Not surprisingly, we can't tell a thing without seeing your code. 

It’s possible your application is relying on a feature or on code
ordering that was never anticipated or never documented. No one is
claiming wxPython 3.0 is perfect, but remember that just because an
application works does not necessarily mean it is correct.

-- Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

That’s going to create the list in “large icon” mode (LC_ICON). Is
that what you wanted? You haven’t set an image list for it to
select the icons. Most people want LC_REPORT or LC_LIST when they
use a ListCtrl.
Please note that I’m not saying this is the cause of the crash. I’m
merely noting that it is unusual.

···

Austin Grelle wrote:

Thanks for the reply Tim.

Here is some more detail and code:

Creation of the PINC1box ListCtrl

        # Create the top of the PINC panel for

‘Populated’ PINCs

self.panelPINC1 = wx.Panel(self.panelRight)

PINC1sizer = wx.BoxSizer(wx.VERTICAL)

        self.PINC1text = wx.StaticText(self.panelPINC1,

label = “Selected PINCs for viewing:”)

self.PINC1box = wx.ListCtrl(self.panelPINC1)

        self.PINC1box.Bind(wx.EVT_LIST_ITEM_SELECTED,

self.OnItemSelected)

        self.PINC1box.Bind(wx.EVT_LIST_ITEM_DESELECTED,

self.OnItemDeSelected)

-- Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com

Sorry I meant ListCtrl not ListBox…

···

On Thursday, June 19, 2014 7:09:19 AM UTC-7, Austin Grelle wrote:

Thanks for the reply. This error occurred using wx.ListCtrl (http://www.wxpython.org/docs/api/wx.ListCtrl-class.html ), I’m not sure if it will affect the ListBox.

On Tuesday, June 17, 2014 2:56:06 PM UTC-5, Nathan McCorkle wrote:

FWIW I just tried my ListBox program with 3.0 and Append works for an object that is a subclass of wx.ListCtrl, listmix.ListCtrlAutoWidthMixin

On Tuesday, June 17, 2014 8:08:43 AM UTC-7, Austin Grelle wrote:

Good Morning,

I’ve been developing on wxPython version 2.8 for awhile, and have a application developed and tested that works for that version.

This morning, I installed wxPython 3.0 for a colleague and gave him the application. When my program tried to Insert an item to a ListCtrl item, the following error is produced:

Traceback (most recent call last):

File “Program.py”, line 305, in Function

self.box.InsertItem(item)

File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_controls.py”, line 4709, in InsertItem

return controls.ListCtrl_InsertItem(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “rv != -1” failed at …..\src\msw\listctrl.cpp(1722) in wxListCtrl::InsertItem(): failed to insert an item in wxListCtrl

I ended up uninstalling 3.0 and installing 2.8 for him. However, I’m curious… is this a feature or a bug of 3.0?

Thanks,

Austin Grelle

This is a similar error:
http://wxpython-users.1045709.n5.nabble.com/wx-ListCtrl-InsertItem-raises-an-exception-td2305865.html

···

On Thursday, June 19, 2014 1:44:42 PM UTC-7, Nathan McCorkle wrote:

Sorry I meant ListCtrl not ListBox…

On Thursday, June 19, 2014 7:09:19 AM UTC-7, Austin Grelle wrote:

Thanks for the reply. This error occurred using wx.ListCtrl (http://www.wxpython.org/docs/api/wx.ListCtrl-class.html ), I’m not sure if it will affect the ListBox.

On Tuesday, June 17, 2014 2:56:06 PM UTC-5, Nathan McCorkle wrote:

FWIW I just tried my ListBox program with 3.0 and Append works for an object that is a subclass of wx.ListCtrl, listmix.ListCtrlAutoWidthMixin

On Tuesday, June 17, 2014 8:08:43 AM UTC-7, Austin Grelle wrote:

Good Morning,

I’ve been developing on wxPython version 2.8 for awhile, and have a application developed and tested that works for that version.

This morning, I installed wxPython 3.0 for a colleague and gave him the application. When my program tried to Insert an item to a ListCtrl item, the following error is produced:

Traceback (most recent call last):

File “Program.py”, line 305, in Function

self.box.InsertItem(item)

File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_controls.py”, line 4709, in InsertItem

return controls.ListCtrl_InsertItem(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “rv != -1” failed at …..\src\msw\listctrl.cpp(1722) in wxListCtrl::InsertItem(): failed to insert an item in wxListCtrl

I ended up uninstalling 3.0 and installing 2.8 for him. However, I’m curious… is this a feature or a bug of 3.0?

Thanks,

Austin Grelle

Correct, I actually do want it in the Large Icon mode with just text items to be displayed for the user to select.

Therefore I don’t want any image associated with the item, just the Text.

···

On Thursday, June 19, 2014 2:58:05 PM UTC-5, Tim Roberts wrote:

Austin Grelle wrote:

Thanks for the reply Tim.

Here is some more detail and code:

Creation of the PINC1box ListCtrl

        # Create the top of the PINC panel for

‘Populated’ PINCs

self.panelPINC1 = wx.Panel(self.panelRight)

PINC1sizer = wx.BoxSizer(wx.VERTICAL)

        self.PINC1text = wx.StaticText(self.panelPINC1,

label = “Selected PINCs for viewing:”)

self.PINC1box = wx.ListCtrl(self.panelPINC1)

self.PINC1box.Bind(wx.EVT_ LIST_ITEM_SELECTED,
self.OnItemSelected)

self.PINC1box.Bind(wx.EVT_ LIST_ITEM_DESELECTED,
self.OnItemDeSelected)

That's going to create the list in "large icon" mode (LC_ICON).  Is

that what you wanted? You haven’t set an image list for it to
select the icons. Most people want LC_REPORT or LC_LIST when they
use a ListCtrl.

Please note that I'm not saying this is the cause of the crash.  I'm

merely noting that it is unusual.

-- Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Here’s an attached image of the panel working in wx2.8.x

···

On Thursday, June 19, 2014 2:58:05 PM UTC-5, Tim Roberts wrote:

Austin Grelle wrote:

Thanks for the reply Tim.

Here is some more detail and code:

Creation of the PINC1box ListCtrl

        # Create the top of the PINC panel for

‘Populated’ PINCs

self.panelPINC1 = wx.Panel(self.panelRight)

PINC1sizer = wx.BoxSizer(wx.VERTICAL)

        self.PINC1text = wx.StaticText(self.panelPINC1,

label = “Selected PINCs for viewing:”)

self.PINC1box = wx.ListCtrl(self.panelPINC1)

self.PINC1box.Bind(wx.EVT_ LIST_ITEM_SELECTED,
self.OnItemSelected)

self.PINC1box.Bind(wx.EVT_ LIST_ITEM_DESELECTED,
self.OnItemDeSelected)

That's going to create the list in "large icon" mode (LC_ICON).  Is

that what you wanted? You haven’t set an image list for it to
select the icons. Most people want LC_REPORT or LC_LIST when they
use a ListCtrl.

Please note that I'm not saying this is the cause of the crash.  I'm

merely noting that it is unusual.

-- Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Austin Grelle wrote:

Correct, I actually do want it in the Large Icon mode with just text
items to be displayed for the user to select.

Therefore I don't want any image associated with the item, just the Text.

Did you see the link from Nathan that suggested the crash is due to not
having any columns? You shouldn't need columns in LC_ICON mode, but it
would be a quick experiment to try adding one.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Nathan’s comment was something I wondered, as I had read this comment from 6 years ago on the wxwidgets site : ( wxTrac has been migrated to GitHub Issues - wxWidgets )

Considering this didn’t affect my version in 2.8.x, I didn’t initially want to try to put in a column as I don’t want a label associated with the items.

As I was looking at inserting a column prior to appending items, I noticed the InsertStringItem function and tested it out. It turns out that fulfills what I want to do and perhaps is a little more clear at the same time. Therefore, with this idea (and a better mechanism to iterate over the reverse of the list), the function:

Old Version

def OnAddAllPINCs(self, event):

x = self.PINCs

x.reverse()

for name in x:

if name not in self.addedPINCS and (name.count(“-”) <= 2):

item = wx.ListItem()

item.SetText(name)

self.listPINCS.append(item)

self.addedPINCS.append(name)

self.PINC1box.InsertItem(item)

···

Now becomes:

New Version

def OnAddAllPINCs(self, event):

for name in self.PINCs[::-1]:

if name not in self.addedPINCS and (name.count(“-”) <= 2):

self.listPINCS.append(name)

self.addedPINCS.append(name)

self.PINC1box.InsertStringItem(0, name)


This fixes the problem I had and the program works in 3.0.0.0, and is back-compatible with 2.8.12.1.

It is probably what I should have done in the first place. Having a chance to go back and look at code written in the past is pretty revealing sometimes…

Thanks for your help (and everyone else’s).

-Austin

On Thursday, June 19, 2014 5:23:40 PM UTC-5, Tim Roberts wrote:

Austin Grelle wrote:

Correct, I actually do want it in the Large Icon mode with just text

items to be displayed for the user to select.

Therefore I don’t want any image associated with the item, just the Text.

Did you see the link from Nathan that suggested the crash is due to not

having any columns? You shouldn’t need columns in LC_ICON mode, but it

would be a quick experiment to try adding one.


Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.

As I was looking at inserting a column prior to appending items, I noticed the InsertStringItem function and tested it out. It turns out that fulfills what I want to do and perhaps is a little more clear at the same time.

As long as you are optimizing, allow me to point out that

name.startswith(’—’)

would be much quicker than

name.count('-') <= 2

name.count requires you to examine every character.

···

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

Good point. I’ll change that, thanks.

···

On Friday, June 20, 2014 11:38:48 AM UTC-5, Tim Roberts wrote:

As I was looking at inserting a column prior to appending items, I noticed the InsertStringItem function and tested it out. It turns out that fulfills what I want to do and perhaps is a little more clear at the same time.

As long as you are optimizing, allow me to point out that

name.startswith(‘—’)

would be much quicker than

name.count('-') <= 2

name.count requires you to examine every character.

Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.

Glad you were able to use InsertStringItem… still seems like a quite strange bug though (or lack of proper/complete documentation).

···

On Friday, June 20, 2014 9:35:01 AM UTC-7, Austin Grelle wrote:

Nathan’s comment was something I wondered, as I had read this comment from 6 years ago on the wxwidgets site : ( http://trac.wxwidgets.org/ticket/4669 )

Considering this didn’t affect my version in 2.8.x, I didn’t initially want to try to put in a column as I don’t want a label associated with the items.

As I was looking at inserting a column prior to appending items, I noticed the InsertStringItem function and tested it out. It turns out that fulfills what I want to do and perhaps is a little more clear at the same time. Therefore, with this idea (and a better mechanism to iterate over the reverse of the list), the function:

Old Version

def OnAddAllPINCs(self, event):

x = self.PINCs

x.reverse()

for name in x:

if name not in self.addedPINCS and (name.count(“-”) <= 2):

item = wx.ListItem()

item.SetText(name)

self.listPINCS.append(item)

self.addedPINCS.append(name)

self.PINC1box.InsertItem(item)


Now becomes:

New Version

def OnAddAllPINCs(self, event):

for name in self.PINCs[::-1]:

if name not in self.addedPINCS and (name.count(“-”) <= 2):

self.listPINCS.append(name)

self.addedPINCS.append(name)

self.PINC1box.InsertStringItem(0, name)


This fixes the problem I had and the program works in 3.0.0.0, and is back-compatible with 2.8.12.1.

It is probably what I should have done in the first place. Having a chance to go back and look at code written in the past is pretty revealing sometimes…

Thanks for your help (and everyone else’s).

-Austin

On Thursday, June 19, 2014 5:23:40 PM UTC-5, Tim Roberts wrote:

Austin Grelle wrote:

Correct, I actually do want it in the Large Icon mode with just text

items to be displayed for the user to select.

Therefore I don’t want any image associated with the item, just the Text.

Did you see the link from Nathan that suggested the crash is due to not

having any columns? You shouldn’t need columns in LC_ICON mode, but it

would be a quick experiment to try adding one.


Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.

Don’t know if it makes any difference in Austin’s code, but startswith and count will have different results depending on the string:

···

“-t-est”.startswith(‘–’)

False

“-t-est”.count(‘-’) <= 2

True

Am Freitag, 20. Juni 2014 18:38:48 UTC+2 schrieb Tim Roberts:

As I was looking at inserting a column prior to appending items, I noticed the InsertStringItem function and tested it out. It turns out that fulfills what I want to do and perhaps is a little more clear at the same time.

As long as you are optimizing, allow me to point out that

name.startswith(‘—’)

would be much quicker than

name.count('-') <= 2

name.count requires you to examine every character.

Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.