Python addin error: SystemError: NULL object passed to Py_BuildValue

778
6
10-29-2013 07:39 AM
ionarawilson1
Occasional Contributor III
I have a python addin combox. Based on the selection of the combobox the user will get a message. When I test it inside Arcmap, I can see an error in the python window. Can anybody tell me what's wrong with my code that is producing this error? Thanks

This is the error:

SystemError: NULL object passed to Py_BuildValue


import arcpy
import pythonaddins

class ComboBoxClass1(object):
    """Implementation for SARS6_addin.combobox (ComboBox)"""
    def __init__(self):
        self.items = ["Forestry Stewardship", "Forestry Management Plan", "Reforestation Accomplished - TFS", "Reforestation Accomplished - Non TFS", "Tree Farm Program - Reinspections", "Tree Farm Program - New Inspections", "Certified Forest Steward - Assist", "Timber Theft Damage Appraisal", "Referral - Consulting Forester", "Referral Vendor", "Incidental Rural Forestry", "Prevention and Reduction of Pest Losses", "Forest Health Monitoring - Survey", "Forest Inventory & Analysis (FIA) Assist", "Best Management Practices (BMP) Assist"]
        self.editable = False
        self.enabled = True
        self.dropdownWidth = 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWW'
        self.width = 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW'
    def onSelChange(self, selection):
         if selection == "Forestry Stewardship":
                    pythonaddins.MessageBox("If in edit mode, please digitize the stewardship boundary and run the ""Stewardship"" tool", "Warning", 0)
    def onEditChange(self, text):
        pass
    def onFocus(self, focused):
        pass
    def onEnter(self):
        pass
    def refresh(self):
        pass
Tags (2)
0 Kudos
6 Replies
JasonScheirer
Occasional Contributor III
When does this occur? In what method? Does it give any more information? Do the items you assign in __init__ show up in the combobox? What version of ArcGIS are you using?
0 Kudos
ionarawilson1
Occasional Contributor III
It shows up after I hit ok in the message box. The items appear, but after I click ok, the item does not stay selected. I can see the item and the other items if I use the dropdown menu, but it would be nice if it stayed selected. It does not provide any other information. I am using 10.1. Thank you Jason!
0 Kudos
JasonScheirer
Occasional Contributor III
Issue appears to have been fixed either in 10.1 SP1 or 10.2.
0 Kudos
ionarawilson1
Occasional Contributor III
I do have sp1
0 Kudos
ionarawilson1
Occasional Contributor III
How can I make it stay selected after I hit ok? thanks
0 Kudos
ionarawilson1
Occasional Contributor III
I figured: You just need to make it editable
0 Kudos