How are you stopping the code ?I added theand it didn't say "syntax error" but when I ran the code it recorded fine but when I stopped it, it still was recording. It was supposed to stop recording when I stopped the code but it didn't. Any ideas how to fix?Code:
try:
Assuming the code as you have it is as below, and things work as hoped -
Code:
try: send_command("Record1stChoice")except KeyboardInterrupt: send_command("Stop") sys.exit()
If that is your code, there's nothing after it, it should automatically exit to the command line after sending the "Record1stChoice", no need to explicitly stop the code.
It seems to be behaving as expected. You would need a 'while True: pass' after sending "Record1stChoice" so you then have to use Ctrl-C to have the exception handle that and send the "Stop" command. Something like this though not correct use of error trapping IMO -
Code:
try: send_command("Record1stChoice") while True: passexcept KeyboardInterrupt: send_command("Stop") sys.exit()
Code:
send_command("Record1stChoice")try: while True: passexcept KeyboardInterrupt: passsend_command("Stop")
Statistics: Posted by hippy — Tue Feb 27, 2024 3:36 pm