Python Snippet node problem since update

Hi,

I have just updated our version of KNIME server to KNIME 2.11.2.  I am now finding that the installed version of the python snippet node (2.0.2.201502181300) appears to be causing previously written workflows to fail.  These were running fine under our previous KNIME server (2.10.4) - where I checked the version of the python scripting extension was 2.0.0.201411121006.

 

Here is an example of the errors I see with the nodes now:

2015-03-11 09:00:11,607 ERROR KNIME-Worker-15 Python Snippet : Execute failed: ("ArrayIndexOutOfBoundsException"): 2
2015-03-11 09:00:11,608 DEBUG KNIME-Worker-15 Python Snippet : Execute failed: ("ArrayIndexOutOfBoundsException"): 2
java.lang.ArrayIndexOutOfBoundsException: 2
    at de.mpicbg.knime.scripting.python.PythonTableConverter.convertCSVToTable(PythonTableConverter.java:64)
    at de.mpicbg.knime.scripting.python.PythonSnippetNodeModel.execute(PythonSnippetNodeModel.java:105)
    at org.knime.core.node.NodeModel.execute(NodeModel.java:706)
    at org.knime.core.node.NodeModel.executeModel(NodeModel.java:555)
    at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1131)
    at org.knime.core.node.Node.execute(Node.java:927)
    at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:559)
    at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
    at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:179)
    at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:110)
    at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:328)
    at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:204)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:125)
    at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:248)
2015-03-11 09:00:11,608 DEBUG KNIME-Worker-15 WorkflowManager : Python Snippet 0:304 doBeforePostExecution
2015-03-11 09:00:11,608 DEBUG KNIME-Worker-15 NodeContainer : Python Snippet 0:304 has new state: POSTEXECUTE
2015-03-11 09:00:11,608 DEBUG KNIME-Worker-15 WorkflowManager : Python Snippet 0:304 doAfterExecute - failure

If I paste the code into one of the 'new' Python Script nodes (and modify slightly to fit the new model - eg 'input_table' vs 'kIn', etc) the node runs fine.  However, it would be really useful to not have to do this for all of our legacy workflows in one go(!) - so I wondered if there is a chance an update could fix the issue?

 

Kind regards

James 

 

Hi,

does the error also occur with fresh nodes (no fancy script, just passing the data)?

if no, would it be somehow possible to get a small workflow which shows that error?

Hi,

No - the error doesn't occur with a 'blank' python snippet cell.  I think I have figured-out what the problem is, though - and I expect you will be able to reproduce it with the following sort of snippet:

 

pyOut = kIn

output = []
for row in kIn['input']:
    output.append('test\ntest')

pyOut['output'] = output

 

So - it seems that newline characters (and possibly other escaped characters?) are now being handled differently...

Kind regards

James

I can reproduce the problem with your example. Indeed, it's the line break causing the problem.
Though my error message is different than the one you posted:

ERROR	 Python Snippet                	 Execute failed: unsupported string found in CSV:test"
/var/folders/b0/xdzvxf197ls___gmw4_y23r80000gp/T/python2knime585668614514203251.csv

I will look into that problem and try to fix it.

Thanks a lot for reporting the issue!

Antje

 

I am experiencing similar problems with Python snippets in Knime.  Code that was working in version 2.10.x does not always seem to work in 2.11.3  I am getting the "unsupported string found in CSV:" errors for data with a \n within a cell as well as columns that are typed at INT where there are missing (?) values.  None of this was a problem with the earlier versions.

Has there been any progress in solving this problem?  It's made many of my older workflows worthless with the latest Knime version. I'd simply roll back and wait out for a version that's stable with Python, but alas, this is not a viable long-term solution.

@jeshleman :

I'm sorry that your snippets do not work anymore. I've made changes at the transfer KNIME > Python to solve other issues. I could solve them but these changes introduced other issues (missing values for INT). I still need to look into the '\n' issue (sorry - I forgot to put it into the issue tracker...).

There are plans to implement major changes to provide a more solid solution.