Skip to content

breaking: from_format errors out when there is no local timezone configuration but timezone is passed in #613

@ayoung19

Description

@ayoung19
  • I am on the latest Pendulum version.
    I have searched the issues of this repo and believe that this is not a duplicate.
  • OS version and name: This is a docker container, so the output of cat /proc/version is this: Linux version 5.4.0-1071-aws (buildd@lcy02-amd64-020) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04))
  • Pendulum version: 2.1.2

Issue

In a docker container with no timezone configuration (presumably), from_format errors out when passing in the timezone parameter. For example, this line from the docs: pendulum.from_format('1975-05-21 22', 'YYYY-MM-DD HH', tz='Europe/London') will spit out the error RuntimeError: Unable to find any timezone configuration. This same behavior happens when I try to run something like pendulum.now() with no arguments which makes sense because I'm assuming it's trying to get the local time but can't. In our docker container we strictly do not want anything to use local time when it's not needed which is why there is no timezone configuration and I feel like it's completely unnecessary here. If I pass in the tz parameter it shouldn't need to rely on local time at all. Looking at the source code, I'm pretty sure this is because now() is being used here: https://github.com/sdispater/pendulum/blob/f1df7dc3f838bd4ab1075ba25c8b6ce5d8141995/pendulum/__init__.py#L238. I'd love to use pendulum in our production server given the ease of managing timezones, but this behavior is completely blocking it and rendering it unusable right now.

Activity

changed the title [-]from_format tries to find the local timezone configuration when that shouldn't be needed[/-] [+]breaking: from_format tries errors out when there is no local timezone configuration but timezone is passed in[/+] on Apr 14, 2022
changed the title [-]breaking: from_format tries errors out when there is no local timezone configuration but timezone is passed in[/-] [+]breaking: from_format errors out when there is no local timezone configuration but timezone is passed in[/+] on Apr 19, 2022
raprocks

raprocks commented on May 13, 2023

@raprocks

any update on this?

ayoung19

ayoung19 commented on May 24, 2023

@ayoung19
Author

i believe this was fixed

ayoung19

ayoung19 commented on May 24, 2023

@ayoung19
Author

@sdispater my opened pr has conflicts and it seems like you completely changed the code, could you confirm this has been fixed?

raprocks

raprocks commented on May 24, 2023

@raprocks

i believe this was fixed

Will update and try, was still facing the issue on latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @ayoung19@raprocks

      Issue actions

        breaking: from_format errors out when there is no local timezone configuration but timezone is passed in · Issue #613 · python-pendulum/pendulum