Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOC Add FAQ about loading external python files (#727)
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Frequently Asked Questions (FAQ) | ||
|
||
### How can I load external python files in Pyodide? | ||
|
||
The two possible solutions are, | ||
|
||
- include these files in a python package, build a pure python wheel with | ||
`python setup.py bdist_wheel` and [load it with micropip](./pypi.html#installing-wheels-from-arbitrary-urls). | ||
- fetch the python code as a string and evaluate it in Python, | ||
```js | ||
pyodide.eval_code(pyodide.open_url('https://some_url/...')) | ||
``` | ||
|
||
In both cases, files need to be served with a web server and cannot be loaded from local file system. | ||
|
||
### Why can't I load files from the local file system? | ||
|
||
For security reasons JavaScript in the browser is not allowed to load local | ||
data files. You need to serve them with a web-browser. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ to be used with Pyodide. | |
|
||
pypi.md | ||
api_reference.md | ||
faq.md | ||
|
||
Developing Pyodide | ||
================== | ||
|