Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5070

Python • Re: How do I fix this Python code?

$
0
0
No, the point is when you stop the code it stops the recording. Is there a command or something like sys.exit() I accomplish this?
There's atexit. You might want to try putting something like this near the top of your code, but after where you define send_command():

Code:

import atexitdef stop_recording():    send_command("Stop")    atexit.register(stop_recording)# ... the rest of your code follows
Interesting.

I'll have to read up the docs on this.

Statistics: Posted by memjr — Thu Feb 29, 2024 6:33 pm



Viewing all articles
Browse latest Browse all 5070

Trending Articles