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

block_scheduler raise error #532

Closed
CGpythoner opened this issue Jul 27, 2021 · 2 comments
Closed

block_scheduler raise error #532

CGpythoner opened this issue Jul 27, 2021 · 2 comments
Labels

Comments

@CGpythoner
Copy link

block_scheduler_test.py

from apscheduler.schedulers.blocking import BlockingScheduler
import click

def print_hello():
print("hello, --")

@click.command()
@click.option('--hour', help='时间', required=False)
@click.option('--seconds', help='miao', required=False)

def test_case(seconds, hour=None):
sched = BlockingScheduler()
sched.add_job(print_hello, 'interval', hour=hour, seconds=int(seconds))
sched.start()

if name == 'main':
test_case()

**error info **
Traceback (most recent call last):
File "block_scheduler_test.py", line 29, in
test_case()
File "/home/pangqiu/.pyenv/versions/3.6.8/envs/pyenv_368/lib/python3.6/site-packages/click/core.py", line 1137, in call
return self.main(*args, **kwargs)
File "/home/pangqiu/.pyenv/versions/3.6.8/envs/pyenv_368/lib/python3.6/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/home/pangqiu/.pyenv/versions/3.6.8/envs/pyenv_368/lib/python3.6/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pangqiu/.pyenv/versions/3.6.8/envs/pyenv_368/lib/python3.6/site-packages/click/core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "block_scheduler_test.py", line 23, in test_case
sched.add_job(print_hello, 'interval', hour=hour, seconds=int(seconds))
File "/home/pangqiu/.pyenv/versions/3.6.8/envs/pyenv_368/lib/python3.6/site-packages/apscheduler/schedulers/base.py", line 425, in add_job
'trigger': self._create_trigger(trigger, trigger_args),
File "/home/pangqiu/.pyenv/versions/3.6.8/envs/pyenv_368/lib/python3.6/site-packages/apscheduler/schedulers/base.py", line 926, in _create_trigger
return self._create_plugin_instance('trigger', trigger, trigger_args)
File "/home/pangqiu/.pyenv/versions/3.6.8/envs/pyenv_368/lib/python3.6/site-packages/apscheduler/schedulers/base.py", line 911, in _create_plugin_instance
return plugin_cls(**constructor_kwargs)
TypeError: init() got an unexpected keyword argument 'hour'

info
python==3.6.8
APScheduler==3.7.0
click==7.1.2

@agronholm
Copy link
Owner

I think you meant "hours" not "hour".

@CGpythoner
Copy link
Author

I think you meant "hours" not "hour".

thanks !!!

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

No branches or pull requests

2 participants