Skip to content

Fix #256 : check the file existence instead of check if path exists before load a timezone related file #594

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

Merged
merged 1 commit into from
Jan 6, 2022

Conversation

beci
Copy link
Contributor

@beci beci commented Jan 2, 2022

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code.

It's very frustrating, that a single folder existence can take down the whole module. It seems there are linux package maintainers, who think creating a /etc/timezone folder is a good idea. This fixes #256 , I'm quite surprised this has open since 2018 and the bug still exists in 2022.

This fix handles this by checking the file existence instead of path existence before reading timezone-related files.

Instead creating a simple timezone folder in pendulum/tests/fixtures/tz/symlink/etc/ a created a complete fixture for this problem in pendulum/tests/fixtures/tz/timezone_dir/ and a test with that folder.

the file existence instead of check path exists
(which can be valid for folders too).
@beci beci marked this pull request as ready for review January 2, 2022 15:13
@NickFabry NickFabry merged commit 4b79cb7 into python-pendulum:master Jan 6, 2022
@NickFabry
Copy link
Collaborator

Hi @beci - thanks for taking the time to figure out what was causing problems with loading the zonefiles in some situations. This looks like a good way to fix them! Thanks for the contribution.

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 this pull request may close these issues.

IsADirectoryError while getting local timezone
2 participants