Closed linuxminty closed 5 years ago
I think the problem is that the serial interface and the device are continuously re-initialized inside the while loop: this is what is eventually causing the OSError. The latter part of the program would be better written as:
def main():
# create seven segment device
serial = spi(port=0, device=0, gpio=noop())
device = max7219(serial, cascaded=1)
seg = sevensegment(device)
while True:
# Digit futzing
date(seg)
time.sleep(5)
clock(seg, seconds=10)
if __name__ == '__main__':
main()
cleanup()
Thank you, rm-hull, for your prompt and helpful reply. Your suggested code has now been running successfully for a longer time than my previous attempts, so I think you've diagnosed the problem accurately and the revised code is working as it should. It's extremely unlikely that I would have sorted this out on my own. I'm very grateful for your assistance! Thanks again.
Glad it's working. Will now close this issue. Any other questions/issues: please raise a new ticket!
Type of Raspberry Pi
Model 1, B+ (This is a first-generation B+)
Linux Kernel version
Expected behaviour
I have a ZeroSeg 7-segment add-on display on a Raspberry Pi model 1 B+ (first generation B+). I've taken the date and time code from the sevensegment_demo.py and am running it with Python 3, with the addition of "while True" and "cleanup()."
Actual behaviour
It runs fine for a few hours, then it stops with the following message:
OSError: [Errno 24] Too many open files.
Help would be appreciated. Thank you.