September 5, 2019 at 7:58 am #174721ParticipantTopics: 8Replies: 3Points: 26Rank: Member
I am trying to invoke the Python script from powershell. Am passing Python command, Python script path and parameter to the Python script as you can see
When I am executing this, the Python script had been invoked and prcocessed as expected, but meanwhile am getting the below NativeCommandError from Powershell.
The below output has the logs which are printed by Python the Python script. But along with that, Powershell had thrown the error.
I just want to skip this error. However, the functinality wise there is no impact. Please suggest a way to skip this error.
$param_data_path = 'D:\Dinesh_Kumar'
$pyscript_path = 'D:\Dinesh_Kumar\log_rename.py'
$python_cmd = 'D:\Models\ModelScripts\Production\python.cmd'
$cmd = "cmd.exe"
$args = "/c $python_cmd $pyscript_path $param_data_path"
&$cmd $args | Out-Null
Output: (The output contains logs of Python script along with Powershell error.)
cmd.exe : 05/09/19 03:33:27 – INFO – Renaming the log file process started!
At D:\Dinesh_Kumar\myproject\Invoke-Python.ps1:12 char:1
+ &$cmd $args | Out-Null
+ CategoryInfo : NotSpecified: (05/09/19 03:33:...rocess started!:String) , RemoteException
+ FullyQualifiedErrorId : NativeCommandError
05/09/19 03:33:27 – INFO – Function rename_logs completed successfully!
05/09/19 03:33:27 – INFO – Renaming the log file process ended!
September 5, 2019 at 9:56 am #174736ParticipantTopics: 1Replies: 1528Points: 2,581Rank: Community Hero
You must be logged in to reply to this topic.