-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
How to open a file inside <py-script>? #146
Comments
You cannot read/open a file from a local disc, as the code is running in the browser and would not have access to the file system, but you can definitely download the given file over the network (using the native fetch function) |
@Rjtsahu So you are saying that we cannot access the abc.txt file inside the |
@ckavidas Thanks for the description. |
@LakshmanKishore you need to load the file from http/fetch from js import fetch
response = await fetch(URL) please share the snippet of what you are trying to achieve, so I can tell exactly what you can do. |
I have a KNN ML model that was built with scikit-learn and dumped to iris.pkl file using pickle module.
I tried the above snippet but it was showing
Since |
See this example In the code you can see upload file/read file operations which include converting to raw bytes. |
I was able to convert the model into bytes format using the above
I don't know whether this error is due to pkl file or the usage of the pickle inside |
@LakshmanKishore can you verify if it is working in normal mode (python3 standard version), you can try to read the file directly using |
Pickle file is working perfectly fine when the file is located and accessed locally, but when I tried to get the pickle file from online(like from the raw.githubusercontent.com it is showing |
Hey @LakshmanKishore, I'm not super knowledgeable with |
Hello @marimeireles |
Closing it as dup. please redirect any questions related to the topic to the documentation issue. |
Excellent! For those finding their way here, starting in |
Opening a file with
open(filename)
function throws FileNotFound Error.Inside the index.html file if we try to open the abc.txt file using
<py-script> open("abc.txt","r") </py-script>
throws a FileNotFound Error.The text was updated successfully, but these errors were encountered: