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

How to solve this? ValueError: invalid signal error #23

Closed
lengelberts opened this issue Mar 28, 2019 · 3 comments
Closed

How to solve this? ValueError: invalid signal error #23

lengelberts opened this issue Mar 28, 2019 · 3 comments

Comments

@lengelberts
Copy link

lengelberts commented Mar 28, 2019

I am trying to work with SimulaQron (https://github.com/SoftwareQuTech/SimulaQron) on my Windows. However, when I want to start it (via "simulaqron start") I run into the error "ValueError: invalid signal error". The error seems to result from daemons:
image

Therefore, I tried the example on https://github.com/kevinconway/daemons and this indeed gave the same error:
image
Here foo2.py is the second .py file as indicated in the example, so the one with "if __name__".

It seems to me that the problem is with pidfile. The value for pidfile in d = SleepyDaemon(pidfile=pidfile) is in my case:
C:\Users\Lynn\Documents\Capstone\testdaemon sleepy.pid
(Here, testdaemon is the directory in which the files of the example are stored.)

I am wondering if someone has an idea what is causing this problem. It would be great to fix this so that I (and others) could work with SimulaQron and daemons via Windows.

@kevinconway
Copy link
Owner

@lengelberts I believe the issue is that the system, by default, is setting signal handlers for signals that are not supported in Windows. Here are the signals for which we register handlers:

kill_signals = (
        2,  # SIGINT
        3,  # SIGQUIT
        6,  # SIGABRT
        15,  # SIGTERM
)

but Windows does not support SIGQUIT (https://docs.python.org/2/library/signal.html#signal.signal).

One possible way to start would be to make a subclass of the signal handler that uses a different set of signals even if that is the same set minus SIGQUIT. I'm not sure what other changes would need to happen for Windows support as I originally made this library with the intent on managing daemons in a unix/linux type of environment.

@lengelberts
Copy link
Author

Thank you @kevinconway for your quick reply! This seems to be a reasonable explanation indeed. In that case I will for now just avoid using Windows.

@AckslD
Copy link

AckslD commented Apr 4, 2019

@kevinconway It might be nice to say in the setup.py that this package is only for MacOS and Unix. You can do this by for example adding

    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: Unix",
        "Operating System :: MacOS"
    ],

as an argument to setuptools.setup.

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

3 participants