Getting a toDataSet(): 1st arg can't be coerced to org.python.core.PySequence
error when I try and convert the lists to a dataset. I used data.getColumnNames()
[NAME, TAG_PATH, AGGREGATION_MODE, AXIS, SUBPLOT, ENABLED, COLOR, DASH_PATTERN, RENDER_STYLE, LINE_WEIGHT, SHAPE, FILL_SHAPE, LABELS, GROUP_NAME, DIGITAL, OVERRIDE_AUTOCOLOR, HIDDEN, USER_SELECTABLE, SORT_ORDER, USER_REMOVABLE]
Fixed by adding []
around the headers, but now it says row 0 has a different number of columns, which it doesn't... it's literally made from the same dataset...
penData_master = system.dataset.toPyDataSet(event.source.master)
headers = event.source.master.getColumnNames()
penData_edge = []
TAG_PATH_index = event.source.master.getColumnIndex('TAG_PATH')
#print headers
#print len(headers)
for row in penData_master:
new_row = list(row)
new_row[TAG_PATH_index] = row['TAG_PATH'].replace('[MySQL/ignition-desktop-av4v6h5:area_01]',event.source.parent.hist_root_path)
penData_edge.append(new_row)
#print new_row
#print len(new_row)
newData = system.dataset.toDataSet([headers], penData_edge)
len() prints show header and rows are all 20 elements in length. Probably because of the [headers]
. But without the wrapping []
I'm back where I started.
Things just keep getting weirder... so I transposed the headers to a list of lists and no longer get any errors, but now each header is a list...
newData = system.dataset.toDataSet([[str(col)] for col in headers], penData_edge)
Original dataset headers:

New dataset headers:

very confused