"不懂這個pytz的AttributeError:'UTC'物件沒有utc時間區域的屬性"

2024-05-20 20:46:44 发布

您现在位置:Python中文网/ 问答频道 /正文

问题:

execution_date_to_search_for = pytz.timezone('UTC').utc_timezone.localize(datetime.strptime((process["airflow_execution_date"]).replace("T", " "),'%Y-%m-%d %H:%M:%S.%f'))
[2019-02-20 11:56:42,673] {base_task_runner.py:101} INFO - Job 661: Subtask kill_halted_tasks AttributeError: 'UTC' object has no attribute 'utc_timezone'

这个链接包含我用来终止气流暂停任务的源代码。我试图更改时间格式,但它总是抛出一个错误。在

https://github.com/teamclairvoyant/airflow-maintenance-dags/blob/master/kill-halted-tasks/airflow-kill-halted-tasks.py


Tags: topyforsearchdatetasksairflowutc