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

Python • Re: Python Script keeps Exporting after Finally Statement

$
0
0
For declaring the variable as global, wouldn't I just put global rg in every function where it uses it? Eg. close_audio() record_audio() and main()?

Yes. Just like you have with stream and frames in record_audio() and wav_file in main()

That won't solve the discarding exception isse in your functions though.
I made the changes you suggested, but got the same result, it stops and exports, but keeps exporting afterwards. And @joan when I added rg = False where you said, it did the same thing as what @thagrol suggested; it stopped recording and exported, but kept exporting over and over again.

Statistics: Posted by Henrik Gill — Tue Oct 08, 2024 12:01 am



Viewing all articles
Browse latest Browse all 5044

Trending Articles