1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Is there a way to stop running my python script from another python script?

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    I am currently making an audio recorder, and the script runs forever. I am currently trying to figure out a way to stop my audio recorder script, but I've had no such luck.

    So far I've tried this user post: Stackoverflow Question, and tried this:

    import os

    os.system('pkill -f audio-recorder.py')


    But, instead of just stopping it, it terminates it, which doesn't let my audio-recorder script shut down properly. See, my script is set up so that when the finally: block is reached it cleans everything up and stops recording, but if I use that user's answer it doesn't do that. Is there a way to accomplish what I'm doing, stopping a python script gently, not a full on kill?

    Continue reading...

Compartilhe esta Página