-
-
Notifications
You must be signed in to change notification settings - Fork 774
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
pandas.read_csv throws an abort error #351
Comments
The first problem is that it's trying to use the Python network stack to download the file, which won't work due to browser sandboxing. That can be fixed with:
However, behind that is "Blocked loading mixed active content “http://www.sentiweb.fr/datasets/incidence-PAY-3.csv" explained here |
Cc: @khinsen |
@khinsen yes, a fetch section will do the job. Unfortunately, it looks like sentiweb.fr has a restrictive CORs policy, so your browser cannot directly fetch the csv from it. This is an inconvenience we're brainstorming around at the moment, but in the meantime, we have a way of directly uploading data to our server and then serving from there (see this page for an explanation). |
Hi, have just started using iodide, looks fantastic. Apologies if this is answered already, but i was trying to load a csv file, via pandas/python. Can this be done at the moment ? |
Yes, it can be done, but you can't have pandas do the network fetching for you. You have to fetch it using the Web APIs first, then pass that data to pandas. |
@usingdatascience : It looks like in your notebook the issue with loading that .csv is CORS. If you open up the browser's development console, you can see:
This means (in short) that server is not configured to allow pulling that data from a website served at another domain. As @hamilton said, we've been brainstorming a general solution to that problem, but in the meantime, you can download it to your local machine and upload it back to the Iodide server and then use it from there. |
@hamilton Thanks, that workaround works. But I get the impression that we will all pay a steep price for the Web not having a consistent security model. What I couldn't yet figure out is how to access the fetched data from Python. The variable isn't just there, and I can't import it from module |
@khinsen: Looking at your notebook here, it mostly works for me. I needed to run the fetch cell first:
Then the
I had to make one tweak to load it into pandas. The
I haven't tested anything beyond that point, but is does print out a nice Pandas data frame to the output console... |
There's definitely further documentation to be added here, if it doesn't exist already. |
Yes -- absolutely we need better docs and examples around this stuff. |
@mdboom Right, it works, once you know where to look. I saw "undefined" printed in the console and concludes that my variable was undefined, but it seems that it merely means that the result of a Python code block was There are exceptions further down which look related to my brute-force inclusion of the |
Yes -- Pyodide debugging (and WebAssembly debugging more largely) has a ways to go. One thing that might help is described in #366 |
@mdboom I guess I have no other option since the code works just fine in CPython but raises a Python exception with pyodide. To make the idea of debugging even more attractive, the exception is raised not in my code, but in Pandas. So... this looks like a good reason to procrastinate. |
Closing as I think the original issue was answered, and if the remote server doesn't have permissive CORS settings, there isn't much we can do about it. Except maybe using a CORS proxy. |
I noticed this error with the following iodide notebook, hitting "run all".
The text was updated successfully, but these errors were encountered: