I am trying to write a function that calls a linux command that is given as a string.
I have
def run_command(self, command: str) -> None:
subprocess.run(
command.split(),
text=True,
stdout=subprocess.PIPE,
check=True
)
This seems to work with commands such as apt-get update
However when try LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php
I get
FileNotFoundError: [Errno 2] No such file or directory: 'LC_ALL=en_US.UTF-8'
What do I need to change to get this to work with any Linux command?