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

Wrong number of arguments in _signal_handler() #26

Open
igogold opened this issue Jul 20, 2021 · 1 comment
Open

Wrong number of arguments in _signal_handler() #26

igogold opened this issue Jul 20, 2021 · 1 comment

Comments

@igogold
Copy link

igogold commented Jul 20, 2021

When I send Ctrl+C / SIGTERM to running bot script I got such errors (signal should be send twice to completely exit):

Traceback (most recent call last):
  File "/usr/local/bin/icqbot.py", line 510, in <module>
    main()
  File "/usr/local/bin/icqbot.py", line 87, in main
    run_service()
  File "/usr/local/bin/icqbot.py", line 121, in run_service
    bot.idle()
  File "/usr/local/lib/python-venv/icqbot/lib/python3.7/site-packages/bot/bot.py", line 155, in idle
    sleep(1)
TypeError: _signal_handler() takes 2 positional arguments but 3 were given
Exception ignored in: <module 'threading' from '/usr/lib/python3.7/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 1281, in _shutdown
    t.join()
  File "/usr/lib/python3.7/threading.py", line 1032, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
TypeError: _signal_handler() takes 2 positional arguments but 3 were given

I think error because of

signal.signal(signalnum, handler)
The handler is called with two arguments: the signal number and the current stack frame (None or a frame object; for a description of frame objects, see the description in the type hierarchy or see the attribute descriptions in the inspect module).

but _signal_handler() want to get only one argument (after self), not two.

def _signal_handler(self, sig: int):

@retrydev
Copy link

def _signal_handler(self, sig, _):

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