# Python Snippet node problem since update

**URL:** <https://forum.knime.com/t/python-snippet-node-problem-since-update/7502>\
**Category:** Community Extensions\
**Tags:** scripting-extensions\
**Created:** [March 11, 2015, 11:18am UTC](https://forum.knime.com/t/python-snippet-node-problem-since-update/7502 "2015-03-11T11:18:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Davidson](https://forum-cdn.knime.com/user_avatar/forum.knime.com/james_davidson/32/70_2.png) [@James\_Davidson](https://forum.knime.com/u/James_Davidson)\
**Post date:** [March 11, 2015, 11:18am UTC](https://forum.knime.com/t/python-snippet-node-problem-since-update/7502/1 "2015-03-11T11:18:31Z")

</div>

Hi,

I have just updated our version of KNIME server to KNIME 2.11.2. &nbsp;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. &nbsp;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.

&nbsp;

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. &nbsp;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?

&nbsp;

Kind regards

James&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![niederle](https://forum-cdn.knime.com/user_avatar/forum.knime.com/niederle/32/42_2.png) [@niederle](https://forum.knime.com/u/niederle)\
**Post date:** [March 12, 2015, 12:09pm UTC](https://forum.knime.com/t/python-snippet-node-problem-since-update/7502/2 "2015-03-12T12:09:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![James\_Davidson](https://forum-cdn.knime.com/user_avatar/forum.knime.com/james_davidson/32/70_2.png) [@James\_Davidson](https://forum.knime.com/u/James_Davidson)\
**Post date:** [March 12, 2015, 4:53pm UTC](https://forum.knime.com/t/python-snippet-node-problem-since-update/7502/3 "2015-03-12T16:53:32Z")

</div>

Hi,

No - the error doesn't occur with a 'blank' python snippet cell. &nbsp;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:

&nbsp;

```
pyOut = kIn

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

pyOut['output'] = output
```

&nbsp;

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

Kind regards

James

---

<div class="post-metadata">

**Author:** ![niederle](https://forum-cdn.knime.com/user_avatar/forum.knime.com/niederle/32/42_2.png) [@niederle](https://forum.knime.com/u/niederle)\
**Post date:** [March 17, 2015, 11:10am UTC](https://forum.knime.com/t/python-snippet-node-problem-since-update/7502/4 "2015-03-17T11:10:55Z")

</div>

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

&nbsp;

---

<div class="post-metadata">

**Author:** ![jeshleman](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@jeshleman](https://forum.knime.com/u/jeshleman)\
**Post date:** [July 17, 2015, 11:12pm UTC](https://forum.knime.com/t/python-snippet-node-problem-since-update/7502/5 "2015-07-17T23:12:20Z")

</div>

I am experiencing similar problems with Python snippets in Knime.&nbsp; Code that was working in version 2.10.x does not always seem to work in 2.11.3&nbsp; 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.&nbsp; None of this was a problem with the earlier versions.  
  
Has there been any progress in solving this problem?&nbsp; 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.

---

<div class="post-metadata">

**Author:** ![niederle](https://forum-cdn.knime.com/user_avatar/forum.knime.com/niederle/32/42_2.png) [@niederle](https://forum.knime.com/u/niederle)\
**Post date:** [July 31, 2015, 2:42pm UTC](https://forum.knime.com/t/python-snippet-node-problem-since-update/7502/6 "2015-07-31T14:42:10Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [April 21, 2023, 9:29pm UTC](https://forum.knime.com/t/python-snippet-node-problem-since-update/7502/7 "2023-04-21T21:29:11Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
