]> ToastFreeware Gitweb - toast/airingbutler.git/commitdiff
log_mhz19.py: fix deprecation warning with python 3.10
authorgregor herrmann <gregor@toastfreeware.priv.at>
Fri, 1 Apr 2022 23:33:30 +0000 (01:33 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Fri, 1 Apr 2022 23:33:30 +0000 (01:33 +0200)
for further reading and alternative solutions:

DeprecationWarning: There is no current event loop

log_mhz19.py

index e99ceaef8adba343981fb7124eecc3ed5cc85b7d..7dea051cfde76f550daad632558963a63347843c 100755 (executable)
@@ -40,7 +40,7 @@ def main():
     parser.add_argument('--device', '-d', default='/dev/ttyACM0', help='Device where Arduino is connected to')
     args = parser.parse_args()
     logging.basicConfig(level=logging.INFO, format='%(asctime)-15s %(message)s')
-    loop = asyncio.get_event_loop()
+    loop = asyncio.new_event_loop()
     coro = serial_asyncio.create_serial_connection(loop, Receiver, args.device, baudrate=115200)
     loop.run_until_complete(coro)
     loop.run_forever()