ecerulm commented on issue #16551:
URL: https://github.com/apache/airflow/issues/16551#issuecomment-866114299


   Before I go any further: 
   
   The current error comes from `tz = pendulum.timezone(self.timezone.name)` at 
[dag.py](https://github.com/apache/airflow/blob/2a59de3e558e3b60caad876dee8fa4b43a7a17cf/airflow/models/dag.py#L506-L507)
   
   If we just convert the `start_date` to pendulum with 
`pendulum.instance(start_date)` it fail instead with a 
`pendulum.tz.zoneinfo.exceptions.InvalidTimezone: Invalid timezone "+00:00"`  
the timezone name will be `+00:00` and `pendulum.timezone("+00:00")` fails. 
This really surprised me. 
   
   
   So there are some alternatives:
   
   * Use `pendulum.instance()` , let the `self.timezone` be 
`pendulum.tz.timezone.FixedOffset()`/`TimeZone('+00:00')` and replace the `tz = 
pendulum.timezone(self.timezone.name)` with just `tz = self.timezone`
   * Just do `self.timezone = pendulum._safe_timezone(self.timezone)` that will 
convert `timezone.utc` into `TimeZone('UTC')`, but that is an 
**undocumented/private** function of pendulum.
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to