diff --git a/src/pendulum/tz/local_timezone.py b/src/pendulum/tz/local_timezone.py index 3cb488cd..c3816141 100644 --- a/src/pendulum/tz/local_timezone.py +++ b/src/pendulum/tz/local_timezone.py @@ -146,9 +146,16 @@ def _get_windows_timezone() -> Timezone: def _get_darwin_timezone() -> Timezone: - # link will be something like /usr/share/zoneinfo/America/Los_Angeles. - link = os.readlink("/etc/localtime") - tzname = link[link.rfind("zoneinfo/") + 9 :] + try: + # link will be something like /usr/share/zoneinfo/America/Los_Angeles. + link = os.readlink("/etc/localtime") + tzname = link[link.rfind("zoneinfo/") + 9 :] + except Exception: + warnings.warn( + "Unable to find any timezone configuration, defaulting to UTC.", stacklevel=1 + ) + + return UTC return Timezone(tzname)