Есть следующий код:
def First_script():
try:
firefoxdriver.get("https://vk.com/")
time.sleep(5)
login = firefoxdriver.find_element(By.XPATH, '//*[@id="index_email"]')
login.send_keys(first_ac['number'])
time.sleep(5)
password = firefoxdriver.find_element(By.XPATH, '//*[@id="index_pass"]')
password.send_keys(first_ac['pass'])
time.sleep(5)
login.send_keys(Keys.RETURN)
time.sleep(15)
firefoxdriver.get("https://vk.com/services?w=app7804694_702251118")
time.sleep(15)
firefoxdriver.execute_script(f'''{second_script}
''')
time.sleep(5)
# cookies
# pickle.dump( firefoxdriver.get_cookies() , open(f"{vk_username}_cookies.pkl","wb"))
except Exception as ex:
print(ex)
finally:
firefoxdriver.close()
firefoxdriver.quit()
def main():
schedule.every(4).hours.do(First_script())
# schedule.every(10).minutes.do(Second_script())
while True:
schedule.run_pending()
time.sleep(1)
if __name__ == '__main__':
main()
Все работает, только Schedule не перезапускает задачу.
Выдает следующее:
Traceback (most recent call last):
File "C:\Users\adaml\PycharmProjects\avtoregger\main.py", line 134, in <module>
main()
File "C:\Users\adaml\PycharmProjects\avtoregger\main.py", line 126, in main
schedule.every(4).hours.do(First_script())
File "C:\Users\adaml\PycharmProjects\avtoregger\venv\lib\site-packages\schedule\__init__.py", line 625, in do
self.job_func = functools.partial(job_func, *args, **kwargs)
TypeError: the first argument must be callable
В чем дело?