Support Questions

Find answers, ask questions, and share your expertise

issues while runnig python script with command line arguments in execute stream command processor

avatar
Contributor

Hi

I am trying to execute python script using executestreamcommand processor . it was giving error "No Such file or Directory " even file is available in respective directory

my Flow => Generate file processr --> Execute stream command processor

I was two methods for passing arguments to Execute stream command processor for

Method 1:

${arg1},${argg} are passed by generate file processor

commandarguments :/home/suresh/Desktop/wquest1.py ${arg1};${arg2}

command path : python3.6

Method 2:

commandarguments : wquest1.py ${arg1};${arg2}

command path : python3.6

Working directory : /home/suresh/Desktop/

Please help me on this issue . Thanks for your time and consideration

1 ACCEPTED SOLUTION

avatar
New Contributor

For "command path" you probably want something like: "/usr/bin/python3.6" or "/usr/bin/python3"

You can find the exact path to Python by issuing "which python3" from a shell. It may vary between distributions.

When you execute a script through NiFi it doesn't have the environment variables set like a regular user with shell access might. One of these very important environment variables is PATH, which includes the location of /bin and /usr/bin , so when you type "python" at a shell, it knows where to look for whatever "python" is if it's not found in the current directory.

View solution in original post

2 REPLIES 2

avatar
New Contributor

For "command path" you probably want something like: "/usr/bin/python3.6" or "/usr/bin/python3"

You can find the exact path to Python by issuing "which python3" from a shell. It may vary between distributions.

When you execute a script through NiFi it doesn't have the environment variables set like a regular user with shell access might. One of these very important environment variables is PATH, which includes the location of /bin and /usr/bin , so when you type "python" at a shell, it knows where to look for whatever "python" is if it's not found in the current directory.

avatar
Contributor

Thanks for your Answer