0

On a debian Linux server I tried to run a python script with in the python script the following line of code:

subprocess.call('pkill Chrome')

but this caused the following error

FileNotFoundError: [Errno 2] No such file or directory: 'pkill Chrome'

Expecting that it was the command that failed I tried a few different things like writing sudo before the pkill and writing chrome in stead of Chrome but nothing worked. Any ideas how I can kill all chrome instances? Thanks in advance!

Btw, I also tried the same line but with the killall chrome command resulting in a similar error.

  • 1
    Hey, thank you for your reply. The thing that solved it for me was to set the variable ```shell=True```. Using ```shell=True``` it worked with both a list of args and a single string, that did not seem to make a difference in the result. – Pieter Klaassen Jun 05 '22 at 23:31
  • Please post the preceding comment as an answer to your own question. – karel Jun 06 '22 at 04:00

0 Answers0