Support Questions

Find answers, ask questions, and share your expertise

Running a python script through a windows batch file using ExecuteStreamCommand NIFI

New Contributor

I understand that this question may have been repeated many times before - I am new to Nifi and unfortunately none of the previous answers worked for me. 


I am trying to run a simple python script using the ExecuteStreamCommand processor (in Windows 10). However, I cannot call the python script directly from Nifi as it requires the conda environment to be activated (it gives me an import error for python packages- the same happens when the script is called from both nifi and command prompt).


I have since written a basic batch script to activate the conda environment and run the python script (see below).


file: activate,bat

CALL conda activate base


CALL conda deactivate


This works well and produce the output I need when run from the command line. However, calling the bat file from Nifi does not seem to do anything. It does not generate an error (simply pass the incoming flowfile to output with the working directory added to each line of the incoming csv file).


The config in Nifi:

Command Arguments: C:\Temp\activate.bat

Command Path: C:\Windows\System32\cmd.exe

I have wasted too much time to find a fix for this. Any help would be greatly appreciated. 


New Contributor

This worked for me!


cmd "/c activate [my_env] && python && deactivate"




Still not sure what the underlying issue was ....

Super Guru

Command path:   C:\Temp\activate.bat


get rid of the rest

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.