Reputation: 45
i want to use ExecuteStreamCommand in nifi for running a python script say script.py
my script has declared #!/usr/bin/python3
but its not able to read library from python3
I am able to run the script as python3 script.py but cant same on ExecuteStreamCommand of nifi
anyone has the solution
Upvotes: 1
Views: 571
Reputation: 2032
Adding on to Matt's answer
You can point directly to the python3 bin from ExecuteStreamCommand
e.g.
Command path: /usr/bin/python3
Command arguments: /path/to/script.py;x;y;
Secondly, you should not use #!/usr/bin/python3
as a Python3 shebang, instead using #!/usr/bin/env python3
- see here
Should I put #! (shebang) in Python scripts, and what form should it take?
Upvotes: 1
Reputation: 12083
In your example above you are not invoking python3
directly, which is what ExecuteStreamCommand expects (the script path should be an argument). The environment used by NiFi may not be the same as the one you use from a Terminal program, and looking into a file for the shebang line is likely a feature of your shell, which may not be available to the NiFi JVM when executing an external process.
Upvotes: 0