Skip to content

Instantly share code, notes, and snippets.

@bollwyvl
Last active April 2, 2022 18:28
Show Gist options
  • Save bollwyvl/132aaff5cdb2c35ee1f75aed83e87eeb to your computer and use it in GitHub Desktop.
Save bollwyvl/132aaff5cdb2c35ee1f75aed83e87eeb to your computer and use it in GitHub Desktop.
Accessing JupyterLite contents from pyolite
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmshea
Copy link

jmshea commented Jan 30, 2022

This is so super helpful! Thank you, @bollwyvl . I would like to add a note for someone else who runs into this issue -- if you have a binary file, the 'content' will be a string that is encoded using latin-1. I.e., if you want the bytes array (say, to do pickle.loads()), you will need to do:

mybytes=data['content'].encode('latin-1')

@psychemedia
Copy link

Is a complementary put_contents(path) function also possible?

@oscar6echo
Copy link

Yes, see this discussion comment.
It needs be polished and wrapped for users, I'd say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment