i have issue which drives me crazy. i have a command to be executed which success in CMD and fails in windows power shell. i am trying to execute this command from python, but it seems that python executing it using powershell. is it possible to force it to use cmd?! also i need to read the output of the command.
command is :
sfdx force:org:list
Python code :
import subprocess
climain = "sfdx force:org:list"
query = subprocess.check_output(climain, shell=True)
return json.loads(query)
so i need to force python to use cmd instead of powershell and return the output.
UDPATE 1 :
i have tried this .. to force working with cmd
>>> import subprocess
>>> proc = subprocess.Popen('cmd.exe', stdin = subprocess.PIPE, stdout = subprocess.PIPE)
>>> stdout, stderr = proc.communicate('IPCONFIG')
>>> stdout
but its not printing the output of IPCONFIG command.. it just gives this.
Microsoft Windows [Version 10.0.17763.195] (c) 2018 Microsoft Corporation. All rights reserved. (venv) C:\Users\webapp\Desktop\ed1\ed1>More?