srigan1986 - 2020-07-30

Hello All

I need some help. I am creating a deployment tool which works in Windows and the goal is to generate deliverables for a variety of platforms. I want to run the powershell script to call the python scripts prepared with Codesys script engine API. I used start-process cmdlet like

$ImportResult = Start-Process -FilePath "path of CoDeSys.exe" -ArgumentList '--Profile="our codesys profile"', '--runscript="Testme.py"'

I need the return value from this execution to make further decisions down the sequence.

I see nothing when I print the $ImportResult.

The code of Testme.py is:

from future import print_function
import os
import sys

print("Hi Codesys ! I am being tested ")
sys.exit(1)

I guess the python might return 1 but not Codesys.exe ....Here the Codesys window does not close.
I tried with --noUI as well...Here as well I dont read the return value. $Lastexitcode also did not help

I would be glad to see a powershell script reading the exitcode of the python script which does a set of actions in codesys.

Thank you