Re: [Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread Terry Coles
On Friday, 12 February 2021 16:18:22 GMT Ralph Corderoy wrote: > This is still the counting trace which writes at the end? Yes. The 'live' trace generates around 40 MB of data in around 30 seconds It also slows the program so that the other two programs can't connect > It looks like wha

Re: [Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread Ralph Corderoy
Hi Terry, > The module sys.exit() looks useful, but I keep getting: > > Job "check_webserver_commands (trigger: interval[0:00:01], paused)" > raised an exception > Traceback (most recent call last): > File > "/usr/local/lib/python3.7/dist-packages/apscheduler/executors/base.py", line > 125, in

Re: [Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread Terry Coles
On Friday, 12 February 2021 14:44:14 GMT Ralph Corderoy wrote: > There's also sys.exit(). See > https://docs.python.org/3/library/exceptions.html#SystemExit Ralph, Thanks for all the foregoing. The module sys.exit() looks useful, but I keep getting: Job "check_webserver_commands (trigger: int

Re: [Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread Ralph Corderoy
Hi Terry, > Immediately after successfully terminating, the MP3 Player restarts > and I can't see why. Whatever starts it the first time is running again. > python3 -m trace --count -C . minstermusic.py > > Unfortunately, I get no output from the trace command because the program is > designed t

Re: [Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread Terry Coles
On Friday, 12 February 2021 10:45:46 GMT Keith Edmunds wrote: > Let us know how you get on. Well pdb was certainly a help, in that I could single step to the point where the MP3 object (mp3_player) was terminated. At that point pdb was abandoned by the software and the Music Player simply start

Re: [Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread Terry Coles
On Friday, 12 February 2021 11:07:05 GMT PeterMerchant wrote: > I have used the Logger function in Python on the Raspberry Pi to see what my > program is doing. Unfortunately I was unable to get logger working with the > timestamp, but it did write to a logfile for analysis. We have custom logging

Re: [Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread PeterMerchant
Alternatively, is there a way to get trace to do it's stuff while the program is executing? I have used the Logger function in Python on the Raspberry Pi to see what my program is doing. Unfortunately I was unable to get logger working with the timestamp, but it did write to a logfile for an

Re: [Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread Terry Coles
On Friday, 12 February 2021 10:45:46 GMT Keith Edmunds wrote: > Have you tried debugging with pdb? I'd put a breakpoint where the code > stops the player, then step through it from there. If you're not familiar > with that technique it would be helpful for you to understand the > difference between

Re: [Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread Keith Edmunds
Have you tried debugging with pdb? I'd put a breakpoint where the code stops the player, then step through it from there. If you're not familiar with that technique it would be helpful for you to understand the difference between the debugger commands 'next' and 'step'. Let us know how you get on.

[Dorset] Terminate a Python Program Conditionally (or Alternatively Trace a Running Program)

2021-02-12 Thread Terry Coles
Hi, My Music Player software works fine and I'm in the process of debugging the Web App. One of the buttons in the Control Page is to stop the music and when pressed, the mp3 object is terminated successfully, This has worked now for four years in the original program (using a physical switch