0

I have this Python script that start a recording and won't stop until I hit Ctrl+c manually, I'm looking for way to stop the recording by executing a Python script that generate a Ctrl+c.

2
  • 1
    @TomMcLean I think OP wants to generate the press not catch it. Commented Jun 15, 2021 at 10:34
  • This seems to be an XY problem. If you control how this recording script is started (from a main.py), then you can possibly also kill it from this main.py. It doesn't have to be a Ctrl+C. Commented Jun 15, 2021 at 12:03

1 Answer 1

0

If you are in the same python script you can just call sys.exit. Otherwise, you can kill the process by its pid or name. see Kill process by name?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.