Currently if I run the following code from the python command line it writes to the file specified by filename as expected.
import logging
def test():
logging.basicConfig(format='%(asctime)s %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p',
filename=r'C:\Users\theo\Documents\myLog.txt')
logging.warning('Example logged message.')
test()
But when I copy the code into one of my functions and run the function with Pyscripter, it does not seem to write the file. How can I get logging to appear in Pyscripter?
import loggingandlogging.basicConfig(…)in the function? (Also all the dumb stuff, like: is the function actually being called?)\\Stuff\folder? If you justwith open(r'\\Stuff\folder.test.log', 'w') as f: f.write('test')instead of usinglogging, does that work?