Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
ayoung19 opened this issue Apr 14, 2022 · 4 comments · May be fixed by #616
Open
2 tasks done

Comments

@ayoung19
Copy link

ayoung19 commented Apr 14, 2022

  • 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.

@ayoung19 ayoung19 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 Apr 14, 2022
@ayoung19 ayoung19 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 Apr 19, 2022
@raprocks
Copy link

any update on this?

@ayoung19
Copy link
Author

i believe this was fixed

@ayoung19 ayoung19 reopened this May 24, 2023
@ayoung19
Copy link
Author

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

@raprocks
Copy link

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants