Is there a log file that tracks every statement that is being executed when a program is running?
Steve
Gronicus at SGA.Ninja
Sun Oct 25 12:47:26 EDT 2020
Yes, I have been doing this already. I include the line number to help me find, or search for, the location of the print statement. Unfortunately, it requires a keen understanding in which the program has progressed in order to trace.
A printout of every line number executed could help.
FootNote:
If money does not grow on trees, then why do banks have branches?
From: Maxime S <maxischmeii at gmail.com>
Sent: Sunday, October 25, 2020 7:15 AM
To: Steve <Gronicus at sga.ninja>
Cc: Python <python-list at python.org>
Subject: Re: Is there a log file that tracks every statement that is being executed when a program is running?
Hi,
You can use the trace module for that: https://docs.python.org/3.8/library/trace.html
Personally I tend to put print statement at strategic places instead, I find that easier to analyse than a full trace but YMMV.
Maxime
Le dim. 25 oct. 2020 à 01:25, Steve <Gronicus at sga.ninja <mailto:Gronicus at sga.ninja> > a écrit :
This would seriously help troubleshooting for me. I updated a data file and
now my main program is choking on it. When the program encounters an error,
it dumps a bit of information to the screen for a few steps before the error
but that is not enough.
Footnote:
English sprakers on a roller coaster: "Weeee"
Spanish speakers on a rollercoaster: " Nosostros"
-----Original Message-----
From: Python-list <python-list-bounces+gronicus=sga.ninja at python.org <mailto:sga.ninja at python.org> > On
Behalf Of shrimp_banana
Sent: Saturday, October 17, 2020 9:47 PM
To: python-list at python.org <mailto:python-list at python.org>
Subject: Re: File Name issue
On 10/17/20 4:12 PM, Steve wrote:
> The line:
> with open("HOURLYLOG.txt", 'r') as infile:
> works but, when I rename the file, the line:
> with open("HOURLY-LOG.txt", 'r') as infile:
> does not. The complaint is: Cannot Assign to operator > > However, I
have:
> BPM_O2s=open("BPM-O2-Readings.txt","a")
> And it works.
>
> At first, I thought the issue was due to having the - in the filename.
>
> Is there a fix or explanation for this?
> Steve
I am unsure if this will help but you could try putting an r in front of the
quotes to make it take raw data only.
ie.
with open(r"HOURLY-LOG.txt", 'r') as infile
--
https://mail.python.org/mailman/listinfo/python-list
--
https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list