JPython error?? [SOLVED - work-around]

The workflow I have in place is very simple. I have a File Reader (configured to read the iris data set in the Examples folder) connected to a JPython Script 1:1 (no modifications) linked to an Interactive Table. This is just to test the ability to get JPython to work. When I run the project, I get the following errors in the Console output:

******************************************************************
*** Welcome to KNIME v1.2.1 - the Konstanz Information Miner ***
*** Copyright, 2003-2007, Uni Konstanz and KNIME GmbH, Germany ***
******************************************************************
Log file is located at: C:\Program Files\knime_1.2.1\workspace\.metadata\knime\knime.log
WARN File Reader Configure failed: No Settings available.
ERROR PythonScriptNodeModel Traceback (innermost last):
File "<>", line 51, in ?

ERROR PythonScriptNodeModel java.lang.IllegalArgumentException: Cell count in row "Row1" is not equal to length of column names array: 5 vs. 6

at org.knime.core.data.container.DataContainer.addRowToTable(DataContainer.java:464)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)

at org.python.core.PyMethod.__call__(PyMethod.java)

at org.python.core.PyObject.__call__(PyObject.java)

at org.python.core.PyInstance.invoke(PyInstance.java)

at org.python.pycode._pyx0.f$0(<>:51)

at org.python.pycode._pyx0.call_function(<>)

at org.python.core.PyTableCode.call(PyTableCode.java)

at org.python.core.PyCode.call(PyCode.java)

at org.python.core.Py.runCode(Py.java)

at org.python.core.Py.exec(Py.java)

at org.python.util.PythonInterpreter.exec(PythonInterpreter.java)

at org.knime.ext.jython.PythonScriptNodeModel.execute(PythonScriptNodeModel.java:206)

at org.knime.core.node.NodeModel.executeModel(NodeModel.java:441)

at org.knime.core.node.Node.execute(Node.java:971)

at org.knime.core.node.workflow.NodeContainer$1.run(NodeContainer.java:1130)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:123)

ERROR PythonScriptNodeModel java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Cell count in row "Row1" is not equal to length of column names array: 5 vs. 6

ERROR PythonScriptNodeModel null
FULL SCRIPT:
from org.knime.core.data import *
from org.knime.core.data.def import *
from org.knime.base.data.append.column import *
from org.knime.base import *

def val(colname, rowinstance, inport=0) :
__dts = 0
if inport == 0:
__dts = inData0.getDataTableSpec()
else:
__dts = inData1.getDataTableSpec()

index = __dts.findColumnIndex(colname)
cellType = __dts.getColumnSpec(colname).getType().toString()
cellValue = rowinstance.getCell(index)
stringCellValue = str(cellValue)

if cellType == "DoubleCell":
return float(stringCellValue)
elif cellType == "IntCell":
return int(stringCellValue)
else:
return stringCellValue

## Available scripting variables:
## inData0 - input DataTable 0
## outContainer - container housing output DataTable
##
## Example starter script:
##
## dts = inData0.getDataTableSpec()
## inputColumnIndex= dts.findColumnIndex("input_column_name")
##
## iterator = inData0.iterator()
## while iterator.hasNext():
## row = iterator.next()
## cell = row.getCell(inputColumnIndex)
##
## newStringCell = StringCell("some string")
## newIntCell = IntCell(100)
## newDoubleCell = DoubleCell(99.9)
##
## newRow = AppendedColumnRow(row, [newStringCell, newIntCell, newDoubleCell])
## outContainer.addRowToTable(newRow)
##
## Default script:
##
iterator = inData0.iterator()
while iterator.hasNext():
row = iterator.next()
outContainer.addRowToTable(row)

ERROR PythonScriptNodeModel
ERROR JPython Script 1:1 Execute failed
ERROR JPython Script 1:1

Hello Kirk,

yes there is a bug in the JPhython node. As the error message implies, the definition of the output DataTableSpec does not match the DataTableSpec from the execution of the script.

This output DataTableSpec is defined in the dialog of the JPhython node in the 'Script output' tab. This dialog adds a default output column to the DataTableSpec. This is why you get a column names array of length 6 vs. the iris-data cell count of 5.

We have identified and fixed this bug and try to integrate that in one of the next versions. A workaround for now is to open the dialog, select this default column and press the 'Remove Output Column' button.

Nicolas

Nicolas,

Thank you for your prompt response. I have attempted the work-around and it indeed fixes the problem.

-Kirk