I am going off of this thread.
First, I added import sys
to the top of my file. The print statement that I want to log is inside of an if/else statement, specifically in the else
portion. It looks like this:
else:
sys.stdout = open('logfile', 'w')
print("hi")
This does create a file called logfile
in the same directory as the .py
file, but it is emtpy and does not include "hi".