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

pickle.loads fails if pyodide code throws exception #45

Closed
nicornk opened this issue Oct 12, 2022 · 2 comments
Closed

pickle.loads fails if pyodide code throws exception #45

nicornk opened this issue Oct 12, 2022 · 2 comments

Comments

@nicornk
Copy link

nicornk commented Oct 12, 2022

result = pickle.loads(b64decode(result)) in decorator.py fails for me with the following message:

{AttributeError}Can't get attribute 'JsException' on <module 'pyodide' (<_frozen_importlib_external._NamespaceLoader object at 0x1112554e0>)>

The pickle payload starts with this:

b'\x80\x04\x95\x90\x06\x00\x00\x00\x00\x00\x00\x8c\x16tblib.pickling_support\x94\x8c\x12unpickle_exception\x94\x93\x94(\x8c\x07pyodide\x94\x8c\x0bJsException\x94\x93\x94\x8ckNetworkError: Failed to execute \'send\' on \'XMLHttpRequest\': Failed to load \'http://localhost:54082/foobar\'.\x94\x85\x94Nh\x00\x8c\x12unpickle_traceback\x94\x93\x94\x8c\x05tblib\x94\x8c\x05Frame\x94\x93\x94)\x81\x94}\x94(\x8c\x08f_locals\x94}\x94\x8c\tf_globals\x94}\x94\x8c

I am assuming that pyodide.JsException has been moved to pyodide.ffi.JsException

@rth
Copy link
Member

rth commented Oct 12, 2022

Thanks for the report. This will be resolved in #44

@koenvo
Copy link
Contributor

koenvo commented Oct 13, 2022

Just as a note: just spend an hour to find out the ModuleNotFoundError: No module named 'requests' exception was raised during unpickling. My pyodide environment had requests installed, my host didn't. I'll create a PR which throw a meaningful exception on the host to point the user in the right direction.

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

4 participants