From 9a55dec5f2315ed17f2e8eea187e564d74b4c582 Mon Sep 17 00:00:00 2001 From: EggMan20339 <99349302+EggMan20339@users.noreply.github.com> Date: Thu, 9 May 2024 21:53:18 -0400 Subject: [PATCH] more nfc --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index e336a54..2d3091c 100644 --- a/main.py +++ b/main.py @@ -106,14 +106,17 @@ class CliInteraction(UserInteraction): return True def read_nfc_tag(): + clf = None try: clf = nfc.ContactlessFrontend('usb') tag = clf.connect(rdwr={'on-connect': lambda tag: False}) - clf.close() return tag.identifier if tag else None except Exception as e: print("NFC read error:", e) return None + finally: + if clf: + clf.close() while True: