Problem to interrupting process - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Problem to interrupting process (/thread-18480.html) |
Problem to interrupting process - DJ_Depannage - May-19-2019 Hello People, I have problem with my script and I need your help please i use this : and push button with Arduino card connect to bluetooth with Raspberry With library from HZELLER RPI-RGB-LED-MATRIX Python does not execute any command while a text is displayed on the matrice. Of course, if I manually call the python file to send the SIGINT signal, everything works. Could you give me an additional indication to solve this problem please ? ser = serial.Serial('/dev/rfcomm0', 9600) // Connect to the bluetooth while True: result = ser.read() print(result) if result == 'f' : os.system("sudo python ./30.py") // It's display the text on the matrice (library from HZELLER). I Need to do CTRL+C to stop the process. if result == '7' : os.system("sudo python ./killprocess.py") // It's not execute because 30.py is launched RE: Problem to interrupting process - DJ_Depannage - May-20-2019 I will try to be clearer: I have his files: file1.py -> I get the data in bluetooth file2.py -> Send the text to the matrix. file3.py -> I have to do CTRL-C to clear the matrix, it's obligatory if I want to display another text. file4.py -> I prepared this code pid = int (subprocess.Popen (['pgrep', 'python'], stdout = subprocess.PIPE) .stdout.readline () [: - 1]) os.killpg (os.getpgid (pid), signal.SIGINT)If I manually run the file file4.py, the statement arrives at the file file3.py. I need to automate the execution of file4.py when I send a new text to the matrix. But how ? |