ISO-B / pmb-pitft

Small Python program for Pi MusicBox to use with Adafruit PiTFT - 2.8"
30 stars 17 forks source link

NameError: name 'signal' is not defined #8

Closed truckershitch closed 9 years ago

truckershitch commented 9 years ago

A fresh pull of your code gives:

root@MusicBox:~# python /root/pmb-pitft/pmb-pitft/ui.py
0.17.0
Traceback (most recent call last):
  File "/root/pmb-pitft/pmb-pitft/ui.py", line 175, in <module>
    signal(SIGALRM, alarm_handler)
NameError: name 'signal' is not defined

I added this line to ui.py at the top of the file:

import signal

and modified at around lines 176-182:

signal.signal(signal.SIGALRM, alarm_handler)
signal.alarm(3)
try:
        # Set screen size
        size = width, height = 320, 240
        screen = pygame.display.set_mode(size)
        signal.alarm(0)

Disclaimer: I am not a python programmer, but this fixed the issue for me. :)

ISO-B commented 9 years ago

True, I forgot to add that yesterday. Thanks for noticing. Added to file.