Get Easy Charts DB Pens at runtime

I am trying to get the names off an Easy Charts DB Pens at runtime I am passing the DB Pens Dataset and the dropdown list I want to populate to my script, from the dialog box I can see that both arguments are passed to the script OK. When I try to retrieve values from the dataset (last line of code) it causes an exception. How should I retrieve the values from the DB Pens dataset.

def fillList(dropDown, dbPens):
import system
penList = []
header = [“values”, “NAME”]
system.gui.messageBox("DB Pens value: " + dbPens.toString() + "\nDropdown: " + dropDown.toString())
idx = 0
for row in range(dbPens.rowCount):
name = dbPens.getValueAt(row, “NAME”)

Try this:

def fillList(dropDown, dbPens):
	import system 
	penList = [] 
	header = ["values", "NAME"]
	system.gui.messageBox("DB Pens value: " + dbPens.toString() + "\nDropdown: " + dropDown.toString()) 
	idx = 0
	for row in system.dataset.toPyDataSet(dbPens):
		penList.append([row["NAME"], row["NAME"])
		dropDown.data = system.dataset.toDataSet(header, penList)

Thanks adamaustin
That worked for me I didn’t include all the code I had tried converting dpPens to pyDataSet but still couldn’t iterate through it.