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

%load doesn't work as hoped on https #68

Open
stonebig opened this issue Dec 27, 2022 · 5 comments
Open

%load doesn't work as hoped on https #68

stonebig opened this issue Dec 27, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@stonebig
Copy link

Trying to get this to work

%load  https://raw.githubusercontent.com/MicrosoftDocs/mslearn-introduction-to-machine-learning/main/graphing.py 

I get an error:

/tmp/xeus-python-kernel/envs/xeus-python-kernel/lib/python3.10/urllib/request.py in unknown_open(self, req)
   1417     def unknown_open(self, req):
   1418         type = req.type
-> 1419         raise URLError('unknown url type: %s' % type)
   1420 
   1421 def parse_keqv_list(l):

URLError: <urlopen error unknown url type: https>

is it a limitation ? is there a simple workaround ? (via javascript alternative ?)

@stonebig stonebig added the bug Something isn't working label Dec 27, 2022
@stonebig
Copy link
Author

stonebig commented Dec 27, 2022

ok, found there the mother jupyterlite issue .. which is a pyodide temporary limitation
jupyterlite/jupyterlite#919

suggestion one made is:

from js import fetch

suggestion two is:

import pyodide_http
pyodide_http.patch_all()

@stonebig
Copy link
Author

stonebig commented Dec 27, 2022

would it be possible to include pyodide-http ?

image

maybe it's a temporary workaround, so don't know if it's sane to be done.

@martinRenou
Copy link
Member

Your last two comments are very specific to pyodide, unfortunately that won't help in the case of xeus-python.

We will probably need a mock module for urllib/request similar to what we did for requests in https://github.com/emscripten-forge/requests-wasm-polyfill. Maybe a new https://github.com/emscripten-forge/urllib-wasm-polyfill package which uses a similar approach. Maybe @DerThorsten have thought about this before?

@martinRenou martinRenou transferred this issue from jupyterlite/xeus-python-demo Mar 15, 2023
@jtpio jtpio transferred this issue from jupyterlite/xeus-python-kernel Feb 14, 2024
@martinRenou
Copy link
Member

Using the latest jupyterlite-xeus version, you can now install the requests package and use it:

name: xeus-kernels
channels:
  - https://repo.mamba.pm/emscripten-forge
  - conda-forge
dependencies:
  - xeus-python
  - requests

@martinRenou
Copy link
Member

Though %load is still not working because it uses urlllib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants