Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'signal' has no attribute 'SIGALRM' - receive_test.py #7

Closed
sbkirby opened this issue Aug 5, 2020 · 3 comments

Comments

@sbkirby
Copy link
Contributor

sbkirby commented Aug 5, 2020

This following error occurs with Windows 10 while running receive_test.py:

python imagenode\tests\receive_test.py

FPS Test Program:  imagenode\tests\receive_test.py
Option settings:
    Receive Image Type: jpg
    Show Images: True
    Test Duration: 30  seconds
First Image Received. Starting FPS timer.
Python error with no Exception handler:
Traceback error: module 'signal' has no attribute 'SIGALRM'
Traceback (most recent call last):
  File "imagenode\tests\receive_test.py", line 113, in <module>
    receive_images_forever()
  File "imagenode\tests\receive_test.py", line 96, in receive_images_forever
    signal.signal(signal.SIGALRM, timer_done)
AttributeError: module 'signal' has no attribute 'SIGALRM'

Total Number of Images received: 0
Never got any images from imagenode. Ending program.

A work-around (not a fix) for this error can be made to receive_test.py. Add the following line of code to the import section of receive_test.py.

from sys import platform

Next, replace the following lines in function receive_images_forever() with the following:

            signal.signal(signal.SIGALRM, timer_done)
            signal.alarm(TEST_DURATION)

replace with

            if platform != "win32":
                  signal.signal(signal.SIGALRM, timer_done)
                  signal.alarm(TEST_DURATION)
            else:
                  pass

Note: This will stop the error from occurring, but the FPS test will not time out. This will allow you to run the script and tune the motion detection of your YAML file.

@jeffbass
Copy link
Owner

jeffbass commented Aug 5, 2020

Thanks for this bug report. I want to support Windows users and will need to remove references to the unix / Linux SIGALRM from the receive_test.py program but also from the imagenode.py call to the Patience class. The SIGALRM unix OS signal is a simple timer, but it runs asynchronously outside of Python. I will need to replace it with another algorithm.

I should have a fix for this in a few days. Your work-around removes the timer function, which should work fine until then.

@jeffbass
Copy link
Owner

jeffbass commented Aug 6, 2020

I replaced the signal.SIGALRM call with a Python thread and a sleep timer. The receive_test.py program is now working OK without using signal.SIGALRM. I tested it on several Raspberry Pi's, a Linux laptop and a Mac. Worked fine on those. I don't have a Windows machine to check it on Windows. Could you check if receive_test.py works on Windows OK now? Thanks.

@sbkirby
Copy link
Contributor Author

sbkirby commented Aug 7, 2020

Hey Jeff,
It appears to be working fine in Windows.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants