dbader / schedule

Python job scheduling for humans.
https://schedule.readthedocs.io/
MIT License
11.71k stars 960 forks source link

at() takes 2 positional arguments but 3 were given #533

Closed Uranium2 closed 2 years ago

Uranium2 commented 2 years ago

I'm using python 3.8.10 and python 3.7 on Linux (WSL1 for Python3.8.10 and Docker for Python3.7)

I have schedule==1.1.0 in pip3

But when I use the code from the readme with time zone, I get:

>>> schedule.every().day.at("12:42", "Europe/Amsterdam").do(job)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: at() takes 2 positional arguments but 3 were given
yym68686 commented 2 years ago

I have this problem too, so I use UTC, and it works. Europe/Amsterdam is UTC + 2 hours, so you can use:

schedule.every().day.at("10:42").do(job)

to fix it.

Uranium2 commented 2 years ago

That's not a fix. What happens if I have to migrate my servers into an other region and time zone changes? I'll forget to change the time and all my process will have wrong timings.

SimaDovakin commented 2 years ago

I think, that's because newer version of schedule is not loaded to PyPI. When I cloned repo and run schedule.every().day.at("12:42", "Europe/Amsterdam").do(job) every thing is fine. On the PyPI signature of at() method is:

def at(self, time_str):
    ...

but in repo signature is:

def at(self, time_str: str, tz: str = None):
    ....
Uranium2 commented 2 years ago

Sources from pypi are from "April 10, 2021" for version 1.1.0. But master is way ahead than this tag.

So master is not automatically tagged when there's a PR on Master.

Guess I'll have to specify github repos and commit hash in my requirements.txt