python - How to execute any external program from autoit with cmd arguments -
i want execute 1 python script autoit using autoit built-in function shellexecutewait().
my attempt:
$x = shellexecutewait("e:/automation/python/scripts/readlog.py", '-f "file.log" -k "key" -e "errmsg" ') msgbox(0,"x=",string($x)) if @error msgbox(0,"error=",string(@error)) endif
after running this, can see process id in '$x' , '@error' set 0. means autoit launching process.
but python script not producing results (it create results in 1 txt file) producing when executed independently.
seems problem passing cmd args when execute python shellexecute() i.e.
shellexecutewait("e:/automation/python/scripts/readlog.py", '-f "file.log" -k "key" -e "errmsg" ')
how can pass cmd args shellexecutewait() method?
syntax of shellexecutewait():
shellexecutewait ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] )
parameters:
filename :- name of file run (exe, .txt, .lnk, etc).
parameters :- [optional] parameters program. blank ("") uses none.
but information not enough (no examples use of parameters ). note: no problem python script , python script requires 3 cmd line argv's (strings) options -f -k , -e
links:
first, check path python binary e.g. python.exe (wherever python program/binary located) in window's system environment/path.
how run or execute python file autoit
if path there code must work. in $x receive return exit code of python script.
also can try use
runwait('full_path\python.exe readlog.py -f "file.log" -k "key" -e "errmsg"', 'full_path_of_working_directory')
Comments
Post a Comment