OS and subprocess return code 1 whenever execute shell commands with python

Viewed 111
import os
os.system('ls')
  

1

import subprocess
subprocess.run(['cd'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    

CompletedProcess(args=['cd'], returncode=1, stdout=b'', stderr=b'')

Whenever I run these commands, my return code is 1. I tried uuninstalling and reinstalling powershell. I have python 3.9.1

0 Answers
Related