Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1225

Python • Re: Used to work now doesnt

$
0
0
Add logging to your code at each stage to help isolate the issue:

Code:

import logginglogger = logging.getLogger(__name__)logging.basicConfig(filename='test.log',format='%(asctime)s %(message)s', level=logging.INFO)value=1logging.info('begin test')logging.info('value: '+str(value))logging.info('end test')

Code:

pi@raspberrypi:~ $ cat test.log2024-06-07 09:35:59,895 begin test2024-06-07 09:35:59,895 value: 12024-06-07 09:35:59,895 end testpi@raspberrypi:~ $ 

Statistics: Posted by rpiMike — Fri Jun 07, 2024 8:36 am



Viewing all articles
Browse latest Browse all 1225

Trending Articles