AdamLaurie / RFIDIOt

python RFID / NFC library & tools
http://www.rfidiot.org/
1.05k stars 222 forks source link

rfidiot should not exit at module import time #35

Open rhertzog opened 5 years ago

rhertzog commented 5 years ago

There are many tools which expect that all Python modules can be imported without any side-effect. Unfortunately rfidiot is not in that category, when you import the module it will exit with an error messages like this one:

There is no such reader #0, PCSC sees only 0 reader(s)

In Kali Linux, we got this bug report showing an application feature that is broken by rfidiot: https://bugs.kali.org/view.php?id=4056

Please refactor the code to avoid such side effects at import time.

rhertzog commented 5 years ago

FWIW, this is caused by https://github.com/AdamLaurie/RFIDIOt/blob/4eaf194f764442befd1a4bde511a0cd4c193d28d/rfidiot/__init__.py#L194 and https://github.com/AdamLaurie/RFIDIOt/blob/4eaf194f764442befd1a4bde511a0cd4c193d28d/rfidiot/RFIDIOt.py#L100