The above line works if I manually type it into the editor, in the Python line of the Output Log. It works if I call it from within my .py script, manually imported through the Output Log window.
It will not work if I run it the way I need to run it, from the command line of a DOS shell, like this…
It does not error out. The “stat gpu” command is printed in the log, but the stat gpu command never actually gets successfully executed. I have stepped through the code several times and I can not tell what is going wrong.
How can I run a stat console command from within a python script that is passed into UE4Editor-Cmd.exe on the command line?
It seems like when the code was trying to get the stats I was seeing “audio buffer underrun” errors. Maybe the code is confuised about where it should pull the data from. I also sometimes get warnings about threads without metadata. I am investigating that now.
In OutputDeviceRedirector.cpp, in FOutputDeviceRedirector::InternalFlushThreadedLogs, the BufferedLines is garbage, and then it gets filled with messages saying “Audio Buffer Underrun detected”. I think Unreal is supposed to be using a Stats thread, but instead is using the Game thread. I don’t know much about this stuff, but that’s what it seems like. I am not PIE at the moment.
The above all happens even when stat gpu works correctly.
after it does a lot of set up work it then runs UKismetLibrary::ExecuteConsoleCommand()
Could it be that the python script is blocking the Editor until it is finished running, and even though it is running everything “correctly” the Editor shuts down at the end of the python script and we never actually get any stat gpu output?