$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
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 seeabove.
When I am executing this, the Python script had been invoked and processed 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 functionality wise there is no impact. Please suggest a way to skip this error.
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!
Powered by IDERA