So at my current job we use ColdFusion on Windows servers and we didn't want to have to install Python in order to run our Python code (just another dependency we would have to support). Our solution was to compile our python code into exe files using PyInstaller.
In order to compile scripts to .exe files you must do it on a Windows system. You also must have all the dependencies for your script installed as well as PyInstaller. Open a powershell/command prompt and
cd to the directory your python script is that you want to compile and run this command:
pyinstaller --onefile ./script.py
Make sure not to use the argument
--no-console or you will have issues with calling it from ColdFusion if an error occurs. I found if I used this argument and the compiled Python exe had an error it would actually just get stuck open and you have to force close it from Task Manager. ColdFusion will also not give you the error that occurs and will instead hit the page or
cfexecute timeout. I wish ColdFusion timeouts on
cfexecute calls would force close the executable when the timeout is reached but it does not (which feels very wrong to me because isn't that what a timeout is for?).
Using this approach works very well and now all you have to do is deploy your exe file to your server and setup ColdFusion to execute it. Here is an example of calling it via
cfexecute in cfscript:
cfexecute(name="path-to-exeutable.exe", arguments='', variable="execOutput", errorVariable="execErrors", timeout=600);