Closed sra405 closed 2 months ago
Branch issues/979-Productionise_dynamic_pyodide_runner created!
It would be helpful to explain to users why they cannot use certain modules together that they are able to use separately. This scenario will arise when they try to use a pyodide
-only module in combination with a skulpt
-only module, and will lead to the user receiving the skulpt
error message ImportError: No module named {module} on line {line_number} of {file name}
. We can intercept this error message, extract the name of the problematic module and then rewrite the error message or add an explanation onto the end, e.g. ImportError: No module named numpy on line 2 of main.py. This may be because numpy cannot currently be used with p5 or sense_hat.
However, this could be confusing for users in the case where they receive this error message for reasons other than because the modules are incompatible, for example, if they have misspelt the name of the import (which could be an external module, or another file from within the project). The user may also receive this error if they try to import a module that is available in neither pyodide
nor skulpt
.
Libraries that won't work: p5, py5, py5imported (part of py5 anyway) and sense_hat
In discussion with Max & Lois, we think:
I made the message a little more succinct and added scroll if it overflows vertically, and this is what it looks like:
@loiswells97, final copy (also CE'd):
ImportError: No module name X on line 3 of main.py. You should check your code for typos. If you are using p5, py5 or sense_hat, X might not work.
work merged into feature branch
Originally posted by @loiswells97 in #936
closed by #937