From f45f25dd9d2fbbb5cea42e29735c1842237ebd09 Mon Sep 17 00:00:00 2001 From: "Fredrick W. Warren" Date: Tue, 10 Sep 2024 12:33:49 -0600 Subject: [PATCH] updated to use with open() as --- examples/pywmradio.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/pywmradio.py b/examples/pywmradio.py index 5bb4325..4ce209d 100755 --- a/examples/pywmradio.py +++ b/examples/pywmradio.py @@ -43,9 +43,8 @@ class Application(wmoo.Application): configfile = sep.join([environ['HOME'], '.pyradiorc']) - f = open(configfile, 'r', 'utf-8') - t = f.read() - f.close() + with open(configfile, 'r', 'utf-8') as f: + t = f.read() for i in t.split(u'\n'): radiodef = i.split('\t') radioname = radiodef[0].lower()