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

_trigger_timeout() missing 1 required positional argument: 'job' #1366

Closed
loozhengyuan opened this issue Mar 18, 2019 · 3 comments · Fixed by #1367
Closed

_trigger_timeout() missing 1 required positional argument: 'job' #1366

loozhengyuan opened this issue Mar 18, 2019 · 3 comments · Fixed by #1367
Labels

Comments

@loozhengyuan
Copy link
Contributor

loozhengyuan commented Mar 18, 2019

Steps to reproduce

  1. Create a ConversationalHandler and use conversation_timeout=10
  2. Launch the bot
  3. Trigger command to enter conversation
  4. Wait for 10sec
  5. Error appears

Expected behaviour

The conversation should timeout

Actual behaviour

From the chat, nothing happens. If i respond normally after the supposed timeout should have taken place, the bot responds to me as if no timeout has taken place.

Configuration

Operating System:

ProductName:	Mac OS X
ProductVersion:	10.14.3
BuildVersion:	18D109

Version of Python, python-telegram-bot & dependencies:

python-telegram-bot 12.0.0b1
certifi 2019.03.09
future 0.17.1
Python 3.7.2 (default, Feb 12 2019, 08:15:36)  [Clang 10.0.0 (clang-1000.11.45.5)]

Logs

2019-03-18 10:33:52,327 - JobQueue - DEBUG - Ticking jobs with t=1552876432.327480
2019-03-18 10:33:52,329 - JobQueue - DEBUG - Peeked at _trigger_timeout with t=1552876432.325519
2019-03-18 10:33:52,331 - JobQueue - DEBUG - Running job _trigger_timeout
2019-03-18 10:33:52,332 - JobQueue - ERROR - An uncaught error was raised while executing job _trigger_timeout
Traceback (most recent call last):
  File "/venv/lib/python3.7/site-packages/telegram/ext/jobqueue.py", line 260, in tick
    job.run(self._dispatcher)
  File "/venv/lib/python3.7/site-packages/telegram/ext/jobqueue.py", line 388, in run
    self.callback(CallbackContext.from_job(self, dispatcher))
TypeError: _trigger_timeout() missing 1 required positional argument: 'job'
2019-03-18 10:33:52,338 - JobQueue - DEBUG - Dropping non-repeating or removed job _trigger_timeout
@loozhengyuan loozhengyuan changed the title Bug in Bug: _trigger_timeout() missing 1 required positional argument: 'job' Mar 18, 2019
@jsmnbom jsmnbom changed the title Bug: _trigger_timeout() missing 1 required positional argument: 'job' _trigger_timeout() missing 1 required positional argument: 'job' Mar 19, 2019
@jsmnbom
Copy link
Member

jsmnbom commented Mar 19, 2019

It looks like we missed the _trigger_timeout callback when we went through the codebase updating to context based handlers. Thanks for the report, we'll get it fixed when we can :)

jsmnbom pushed a commit that referenced this issue Apr 5, 2019
… 'job' (#1367)

* Fix #1366: _trigger_timeout() missing 1 required positional argument: 'job'

* Add comments
@felixlinker
Copy link

I'm getting the same exception in version 12.0.0b1:

2019-07-22 01:51:36,073 - JobQueue - ERROR - An uncaught error was raised while executing job _trigger_timeout
Traceback (most recent call last):
  File "C:\Users\felix\.virtualenvs\telegram-plakat-bot-C1d6WWSe\lib\site-packages\telegram\ext\jobqueue.py", line 260, in tick
    job.run(self._dispatcher)
  File "C:\Users\felix\.virtualenvs\telegram-plakat-bot-C1d6WWSe\lib\site-packages\telegram\ext\jobqueue.py", line 388, in run
    self.callback(CallbackContext.from_job(self, dispatcher))
TypeError: _trigger_timeout() missing 1 required positional argument: 'job'

This is how my conversation handler looks:

from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, Filters


ANY = range(1)


def start(update, context):
    return ANY


def any(update, context):
    pass


def cancel(update, context):
    return ConversationHandler.END


def no_parse(update, context):
    pass


def conversation_handler():
    return ConversationHandler(
        entry_points=[CommandHandler('tot', start)],
        states={
            ANY: [MessageHandler(
                ~Filters.command,
                any
            )]
        },
        fallbacks=[
            CommandHandler('cancel', cancel),
            MessageHandler(Filters.update, no_parse)
        ],
        conversation_timeout=10
    )

@loozhengyuan
Copy link
Contributor Author

Hello @felixlinker, i think this issue is still existent on the latest beta release which I first encountered it. Until the release is bumped, you can install the master branch so the latest changes are reflected.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants