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

ZoneInfo('UTC') doesn't work on Jupyterlite v0.1.0b17 demo #104

Open
stonebig opened this issue Jan 8, 2023 · 2 comments
Open

ZoneInfo('UTC') doesn't work on Jupyterlite v0.1.0b17 demo #104

stonebig opened this issue Jan 8, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@stonebig
Copy link

stonebig commented Jan 8, 2023

Problem

I would like this to work

from zoneinfo import ZoneInfo
utc = ZoneInfo('UTC')

currently it crashes,
image

the fix proposed here doesn't seem to be in effect emscripten-forge/empack#53

whished result

image

@stonebig stonebig added the enhancement New feature or request label Jan 8, 2023
@stonebig stonebig changed the title ZoneInfo('UTC') dosn't work on Jupyterlite v0.1.0b17 demo ZoneInfo('UTC') doesn't work on Jupyterlite v0.1.0b17 demo Jan 8, 2023
@jtpio
Copy link
Member

jtpio commented Jan 9, 2023

Thanks @stonebig for the report.

This might actually be an issue with Pyodide. The full traceback shows the following:

image

Which looks similar to the error when using the Pyodide console directly:

image

@agriyakhetarpal
Copy link
Member

xref pyodide/pyodide#4668 for the discussion on the Pyodide side – as this is a constraint with CPython, which itself mentions that it falls back to tzdata: https://docs.python.org/3/library/zoneinfo.html#module-zoneinfo.

Sometime later after that, we added a custom error message around this:

ZoneInfoNotFoundError: "No time zone found with key UTC. On Pyodide you must do pyodide.loadPackage('tzdata') package before you use zoneinfo."

which makes things clearer, I hope.

As mentioned, installing tzdata beforehand

%pip install tzdata
from zoneinfo import ZoneInfo
utc = ZoneInfo('UTC')
utc # zoneinfo.ZoneInfo(key='UTC')  

in a JupyterLite REPL works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants