I'm successfully reading data from my NFC tags with the py532lib, using the i2c connection, put out by Hubcitylabs 5 years ago. https://github.com/HubCityLabs/py532lib/blob/master/py532lib/i2c.py
Unfortunately, after running for about 15 minutes, the system crashes with the error:
OSError: Error 24 Too Many Open Files: '/dev/i2c-1'
Here's the portion of code I have written, that's using the library. Anyone have an idea what I need to add in order to actually close out the files? I've done some reading and it sounds like it's leaving open file descriptors (maybe?).
def nfc_list(self):
Mifare().set_max_retries(5)
uid = Mifare().scan_field()
if uid:
print(uid)
"""Grab the entire output of the NFC mobule from the I2C channel."""
self.nfc_read = Pn532_i2c().read_mifare().get_data() #Store it in our variable.
Pn532_i2c().reset_i2c()
#print('nfc_read = ' + str(self.nfc_read))
else:
self.nfc_read = '' #empty out the array
Pn532_i2c().reset_i2c()
#print('no tag found')
self.bus.close()
This thing has been sitting to the side on my desk for a few months now because I just got tired of getting nowhere with it. Any help is greatly appreciated.