External Tool (Labs): command not found. External commands terminated with exit code: 127

Hi everybody,

I’m trying to use the External Tool (Labs) node but I have problems because it seems it doesn’t know where executable files are.

In practice I’m launching the node with the command:

bash -c “my_script.sh %inFile% %outFile%”

Upon execution the command is translated to something like:

bash -c my_script.sh /tmp/bash_20190326_38800/input/port0.csv /tmp/bash_20190326_38800/output/port0.csv

my_script.sh is a bash script inside one of my bash paths and with executable permissions. If I launch the aforementioned command from the console it works without problems but when it’s launched from the External Tool (Labs) node it trigger the following error:

2019-03-26 11:18:35,155 : DEBUG : ExtTool StdErr collector : CommandExecution : External Tool (Labs) : 3:2589:2574 : STDERR: bash: my_script.sh: command not found

2019-03-26 11:18:35,155 : INFO : KNIME-Exttool-11 : CommandExecution : External Tool (Labs) : 3:2589:2574 : External commands terminated with exit code: 127

It seems like the node doesn’t find the path where the script is located. Can anybody help with this issue?

Hi there!

Have you tried with full path?

Also you can check out this example:
https://hub.knime.com/knime/workflows/Examples/06_Control_Structures/06_External_Applications/01_Example_for_the_external_tool_(Linux_or_Mac_only)*RAFvwP40xGCH0ecy

Br,
Ivan

Hi Ivan,
Thanks for your reply! The example workflow you pointed me at has a problem and cannot be run. The Java Edit Variable (simple) node says:

No such variable "knime.node(drop) size.sh" f type STRING

If I try to run the External Tool node in my workflow using the full path, the node is working but the problem is that the script which I’m using is calling other commands that are not found because the bash path is not “exported”.
Is there a way to run a command from the External Tool node, exactly as if it were launched from a bash terminal? (meaning containing all the bash paths)
Thank you in advance

Hi!

I see. I have Windows so wasn’t even trying at first as the workflow fails for it sooner. The problem is there is no drop folder in workflow directory in the subdirectory “Java Edit Variable (#3)”. Create drop folder there and move script (the script is in data folder) in it and then it will work. New, modified workflow will be available soon on the same link.

Nop for the time being. Maybe alternative could be this node from community nodes:
https://hub.knime.com/knime/nodes/Bash*U2uB-qIId1RRfj0Y

This is really not my area so if I missed something don’t hold it against me :wink:

Br,
Ivan

1 Like

Finally I resolved this issue by simply putting a soft link of the executable in the /usr/local/bin dir.
With bash this can be done with the following command:

sudo ln -s /usr/local/bin/my_script.sh /full_path_to_dir_where_the_script_is_located/my_script.sh

It’s a bit strange to me but it seems that the External Tool (Labs) node can look for executable files in the /usr/local/bin but it doesn’t in other dirs which are on the bash path.
Anyway it’s solved.
Thank you

1 Like

Hi!

Glad you found a way! Anyways this node is still in Labs so modifications and upgrades are possible. Your feedback is forwarded :wink:

Br,
Ivan

1 Like