Requirement : I want to read a excel file from my local directory by using <py-script>
Problem Statement : py-script
runs under their own environment. Hence, It is not able to locate the current working directory and when I trying to see the current working directory by using os.cwd()
command. It is returning /home/pyodide
instead of the local directory files.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<py-script>
import os
print(os.listdir())
print(os.getcwd())
</py-script>
</body>
</html>
Hence, It is giving the below error.
FileNotFoundError: [Errno 44] No such file or directory.
Is there any way to achieve the requirement using py-script
?