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

tzlocal/darwin.py relies on systemsetup which no longer works on OSX #42

Closed
dexterp opened this issue Apr 20, 2017 · 2 comments
Closed

Comments

@dexterp
Copy link

dexterp commented Apr 20, 2017

This is on macOS Sierra 10.12.3 (16D32)

% systemsetup -gettimezone
You need administrator access to run this tool... exiting!

def _get_localzone():
    pipe = subprocess.Popen(
        "systemsetup -gettimezone",
        shell=True,
        stderr=subprocess.PIPE,
        stdout=subprocess.PIPE
    )
    tzname = pipe.stdout.read().replace(b'Time Zone: ', b'').strip()

    if not tzname or tzname not in pytz.all_timezones_set:
        # link will be something like /usr/share/zoneinfo/America/Los_Angeles.
        link = os.readlink("/etc/localtime")
        tzname = link[link.rfind("zoneinfo/") + 9:]
    return pytz.timezone(tzname)
@regebro
Copy link
Owner

regebro commented Apr 20, 2017

It should then fall back to the os.readlink way, so it shouldn't be a problem.

@regebro
Copy link
Owner

regebro commented Nov 29, 2017

tzlocal will stop trying to use systemsetup in next release.

@regebro regebro closed this as completed Nov 29, 2017
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

No branches or pull requests

2 participants