Hi,
I am trying to automate MKS commands using python. Please help me to capture the error message.
Example:
import subprocess
import time
viewproject_cmd='im issues'
proc = subprocess.Popen(viewproject_cmd,stdout=subprocess.PIPE,shell=True)
(out, err) = proc.communicate()
The above script is throwing me following error,
*** MKS124814: Cannot show view information: MKS124808: This command requires operands: item id
I am unable to capture the above error in any variable. Also I see this error only if I execute the above python script in the cmd.exe
Please help me to handle the above error in python script itself.
Solved! Go to Solution.
I have got the answer to my question, The below code returns error message if there is any error on execution of si command
import subprocess
viewproject_cmd='im issues'
process = subprocess.Popen(viewproject_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
(out, err) = process.communicate()
print '!!!!ERROR:',err
I dont know nothing about python but the command line perspective 2 informations may help you.
1.)
The error text is output to stderr. To capture it you could do something like
im issues 2> err.txt
2.)
the error code may be visible in the environment variable %errorlevel% after the command has finished
echo %errorlevel%
Regards
Juergen
Thanks Juergen,
I have got the answer to my question, The below code returns error message if there is any error on execution of si command
import subprocess
viewproject_cmd='im issues'
process = subprocess.Popen(viewproject_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
(out, err) = process.communicate()
print '!!!!ERROR:',err
Hi,
Can you please tell me from where I can get the list of Python APIs for MKS?