Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Solved Go to solution

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

New 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

Accepted Solutions

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

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.

2 REPLIES 2

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

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.

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

New Contributor

Thanks for your Answer