0

New to python, but this may be an issue with Thonny also.

The code is an infinite loop acting as a timer.

While True:
    #Determine if relay needs to turn on off

If I have a small number of timer instructions I can still click stop in Thonny and everything works fine, but if I have like 25, thonny completely locks up, can't even close it, but the code is still running fine and the rest of the os works fine. The schedule is a json file loaded into memory.

Can't put a wait in the loop because it is dealing with ms timing, so a half second wait can mess the schedule up.

Is there a better IDE for something like this than Thonny or a good way to stop the code without rebooting?

Haven't done any threadding yet, but if needed I will rewite. 4gb Pi, so memory shouldn't be an issue.

VirtualLife
  • 402
  • 5
  • 14
  • Have you tried killing the job from the terminal? – S3DEV May 16 '20 at 19:14
  • Have a bunch of debug logging to console which doesn't seem to work from the terminal unless I missed something. – VirtualLife May 16 '20 at 19:26
  • 1
    Sorry, I mean open a new terminal, find the PID and use the kill command - on your Py script and/or Thronny. – S3DEV May 16 '20 at 19:28
  • I will try that next time. Any suggestions to make it so I don't have to kill it every time? – VirtualLife May 16 '20 at 21:45
  • I’d prob just write the script in vim and run using the terminal, and give Thonny a miss altogether. Or, if you have the non-server OS on your Pi, use Jupyter. – S3DEV May 16 '20 at 22:06
  • Try "Run => Run current script in Terminal" in Thonny. – Aivar May 17 '20 at 20:27

0 Answers0