Edit: I gave up on Python and wrote the stdout interface with a C++ Win32 Console .exe file. It works fine. Bleegghh.
Old post:
I’m trying to communicate with a Python script. It is not going well.
So, first off, I can’t get the ■■■■■■thing to launch for the life of me – so I’m focusing on that issue. I can get CERTAIN .exe files to launch, but not all of them. If I bundle putty.exe (lol) in a folder called NativeProcess it works fine, but I can’t launch python.exe from my computer.
Check this out:
var file:File = File.applicationDirectory;
if (Capabilities.os.toLowerCase().indexOf("win") > -1)
{
//file = file.resolvePath("NativeProcess/putty.exe"); //:: This works...
//file = file.resolvePath("NativeProcess/test.py"); //:: This is what I really want, and it doesn't work...
//file = file.resolvePath("C:/Windows/notepad.exe"); //:: This works too...
file = file.resolvePath("C:/Python31/python.exe"); //:: This does not work :(
}
log(file.nativePath);
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = file;
var process:NativeProcess = new NativeProcess();
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
process.start(nativeProcessStartupInfo);