python scripting

Can anyone give me a pointer as how to use the python scripting node I keep getting this error:
Executed command: python C:\KNIME\plugins\org.knime.python2_3.5.0.v201712011355\py\ 2.7.0
Could not find python executable at the given location: python

Although I’ve set my preferences to point to a python.exe in the python scripting panel.

Hi @mazzo -

You might find this guide to setting up Python useful. Note that it’s Anaconda specific, though:

Ok - realised that you had to create a new node, because the current one doesn’t detect changes in python paths.
So I changed the path, created a new node and it worked…
Now got another bug:

ERROR Python Script (1⇒1) 6:568:502:0:451 Execute failed: Traceback (most recent call last):
File “C:\KNIME\plugins\org.knime.python2_3.5.0.v201712011355\py\”, line 491, in execute
exec(source_code, self._exec_env, self._exec_env)
File “”, line 22, in
File “C:\a3\envs\knime_keras\lib\site-packages\pandas\core\”, line 404, in init
raise ValueError(‘DataFrame constructor not properly called!’)
ValueError: DataFrame constructor not properly called!



some context, this is from the 3Dechem recent publication Figure 4:

The Python code is below

import math as m
import pandas as pd
import numpy as np
import csv
raws= input_table[‘Sum(similarity)’]

raws = Raw scores

target= input_table[‘target__name’]
ntarg = len(set(target))

add ntarg manually? - bit of a pain -changed

ns1s2 = input_table[‘Count(ingredient__cmpd__chemblid)’]

size of set1*set2

zs = (raws - 0.000424ns1s2)/(0.00449(ns1s2**0.665))

ZScore following Shochet supp info

x = -np.exp((-zs*np.pi)/np.sqrt(6.0)-0.577215665)

needed for Taylor expansion used to approximate PZ below

where 0.577215665 is an approx for Г’(1), the Euler-Mascheroni constant

pz = -(x + (xx)/2.0 + xxx/6.0)
e = (pz
result = {‘nearesttarget’:nearesttarget,‘ns1s2’:ns1s2.astype(float),‘raw-score’:raws,‘z-score’:zs,‘E-value’:e}
pyOut = pd.DataFrame(result.values(),result.keys()).T

not needed print if do in KNIME, uncomment to run/check/debag

print pyOut

pyOut.to_csv(‘C:/Windows/ubuntuse/work/BioAxis/cmbi/value010615_48atestfixnew1.csv’, sep=’\t’, encoding=‘utf-8’)

output_table = pyOut


a bit of digging around and I think it is a versioning issue with old modules:

anyone got any ideas?

so I went to a really old python forum page and used the code there:

but I wonder why KNIME is calling python where I’m not asking it to?
Is this just a windows feature?

Traceback (most recent call last):
File “C:\KNIME\plugins\org.knime.python2_3.5.0.v201712011355\py\”, line 491, in execute
exec(source_code, self._exec_env, self._exec_env)
File “”, line 1, in
ImportError: No module named ‘name_cleaver’

Hi mazzo

I am having an issue with the same code right now and was wondering how you solved it/what code you used to fix the error.

Thanks, Samanta