I am trying to get the full stdout output of my python script execution available in my AutoIt calling script, I just noticed that the standard logging call is not captured by StdoutRead function in autoit.
#include "Constants.au3"
#pragma compile(Console, true)
#AutoIt3Wrapper_Change2CUI=Y
Func ExecTestScript($command, $useEnv="")
Local $line
Local $pid = Run("cmd.exe", @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
StdinWrite($pid, 'cd "' & @ScriptDir & '"' & @CRLF)
If StringLen($useEnv) > 0 Then
StdinWrite($pid, "conda activate " & $useEnv & @CRLF)
EndIf
Local $cmd = $command & @CRLF
ConsoleWrite($cmd & @CRLF)
StdinWrite($pid, $cmd)
StdinWrite($pid, "exit" & @CRLF)
Local $nChars
While 1
$nChars = StdoutRead($pid)
If @error Then ExitLoop
If @extended > 0 Then
ConsoleWrite("++ " & $nChars & @CRLF)
$line &= $nChars
EndIf
WEnd
ProcessClose($pid)
return $line
EndFunc
Local $res = ExecTestScript('python myTestScript.py', 'py38')
My simple python script
import logging
logging.warning("Warning this could HURT!")
print(f'Hello world!')
Here is the debug output of my autoit script.
As you can see the logging instruction appears in SciTe Output but not by means of my script which is logging in green. The SciTe Output also captures the microsoft message when DOS command prompt is openned.
Does someone has a solution or idea of the issue?
logging.warning
might write toCON:
directly (not to STDOUT, so nothing to capture). b)logging.warning
might write to STDERR (so nothing on STDOUT to capture) (I guess, it's easier for you to veryfy/falsify those ideas than it's for me)