280 questions
2
votes
1
answer
73
views
PyScript on Github pages doesn't see files with relative paths
I have a github repo that is hosted on GitHub Pages (project site). I’m migrating a small PyScript demo to GitHub Pages and hitting 404s when preloading files via <py-config>. This works locally ...
2
votes
3
answers
162
views
How to rewrite python code using Pyscript
My code works as python file but I am struggling to make it work using pyscript.I am sharing the code which I tried.
main.py
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r"Tesseract-...
1
vote
2
answers
79
views
Pyscript terminal worker not executing past input()
I'm trying to add a python terminal onto a website using pyscript to run programs I've written using
<script type="mpy" terminal worker src="subrepo/folder/program.py"></...
0
votes
1
answer
60
views
Trying to input the ticker symbol, start and end dates etc. using HTML, CSS and pyscript but cannot get the desired result
This is the html code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-...
-3
votes
1
answer
78
views
Is there any way that we can take in data from a web app, store it into a csv file using python?
I have just begun learning how to use python for web apps. I don't plan on using it but I was just curious and trying it.
I'm trying to take student data like name,roll no, branch and course from html ...
0
votes
0
answers
23
views
Load files in order with pyscript
I am using pyscript and I have a directory structure as follows:
index.html
Classes/Class_A.py
Classes/Class_B.py
where Class_A contains a class A and Class_B contains a class B which inherits from A....
0
votes
1
answer
82
views
Can't get pyscript to import a simple module in the same directory. I see this question all over, but none of the solutions work for me
Should be pretty straight forward, but I keep getting this modulenotfound error. And it looks like every year they change the way to do it and deprecate all other ways.
This is my index.html
<!...
0
votes
1
answer
49
views
py:ready not being called on worker script
I'm running the example code from the documentation for py:ready:
<script>
addEventListener("py:ready", () => {
const status = document.getElementById("...
1
vote
1
answer
52
views
Flask 405 Method Not Allowed for POST request from PyScript
I'm working on a Flask project where I need to send data from a PyScript (running in the browser) to the Flask backend using a POST request. However, when trying to make a POST request from the ...
0
votes
1
answer
65
views
how to do requestAnimationFrame in pyscript
from pyscript import document, window
from pyscript.ffi import create_proxy
class Canvas:
def __init__(self, id, width=64*9, height=64*9):
self.canvas = document.querySelector(id)
...
0
votes
1
answer
61
views
pyscript config file help for pandas and 2 Excel files
I'm using pyscript to run a function from an HTML page that reads an Excel file and returns the value from column two when column one is equal to a text input value on the HTML page. I want to ...
0
votes
1
answer
115
views
How to the fetch() function in PyScript with options
I am confused about the use of the fetch() function in PyScript.
There seems to be two versions of that function:
from the js module
from the pyscript module
Only the first one seems to accept two ...
0
votes
1
answer
88
views
Fetching JSON data with PyScript
I want to fetch json data with PyScript but cannot get over a
pyodide.ffi.JsException: TypeError: NetworkError when attempting to fetch resource.
It works with the sample data (the outcommented lines) ...
0
votes
1
answer
142
views
How to play a mp3 file with PyScript?
I want to play an mp3 file using the HTML tag like so:
<audio controls>
<source id="player" src="sounds//ziege.mp3" type="audio/mpeg">
</...
1
vote
1
answer
152
views
How to connect to my SQL server from Py script?
I am trying to connect to SQL server from Py script and I tried the same code of my jupyternotebook but the page shows blank after I import pyodbc. Is there any other way I connect to my SQL server ...
0
votes
2
answers
525
views
PyScript not displaying output
I am running a very basic pyscript code that accesses a python file.
The following is the HTML file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-...
0
votes
0
answers
86
views
How can I use a compiled python code in pyscript?
I create a pyd compiled python file of a function called sm that calculate the sum of two numbers (just to test the use of compiled python file). The compiled file name is somme.pyd
To test I create ...
0
votes
1
answer
74
views
py-click is disabled without click?
I'm new to Pyscript, I create an UI for password generation, yet the button is grayed out without clicking
<!DOCTYPE html> <html lang="en">
<head>
<title>...
0
votes
1
answer
89
views
CSV file not found error in html file in pyscript tag . Running this html file in python Django web framework
I am learning python django web framework . Reading csv file content and showing in pandas dataframe but getting error file not found. Tried all possible options using latest , alpha pyscript release ....
1
vote
1
answer
238
views
PyScript <script type="py-editor"> Error Unable to use SharedArrayBuffer due insecure environment
I'm using PyScript to run a simple Python script in my HTML file to display a pandas DataFrame. However, after loading the page in browser and clicking the run button of the code block I'm ...
2
votes
1
answer
186
views
Why iframe for an embeded youtube clip does not work in pyscript?
I am making webpages in pyscript. When I add an iframe tag for an embeded youtube clip to an html that is hosted by pyscript.com, the html on a brower shows "www.youtube.com refused to connect.&...
0
votes
0
answers
131
views
Integrating OpenAI API into a Pyscript page - Requests keep timing out
I have a Pyscript page that searches a news archive and returns a list of news summaries. I want to then feed this list of summaries into gpt-4o and get back a brief summary of the material. The ...
0
votes
1
answer
42
views
py-click isn't responding with the function in python
Here is my HTML code:
<!DOCTYPE html>
<html lang="en" class="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" ...
0
votes
1
answer
142
views
I have a Python file that I want to run in an HTML file when a button is pressed using PyScript. How would I do this?
I have a Python file called main.py, which I want to run when a button is pressed in a website I am creating, but I'm unsure how to go about this. I have looked at several different examples on the ...
0
votes
1
answer
241
views
Save and Read File into cookie or localStorage in PyScript
I am trying to write file in PyScript. Writing and reading is OK, but if I refresh the page, all changes are resetted. Can I make PyScript save specific file into localStorage? Like, /home/pyodide/...
0
votes
2
answers
149
views
Indentation issue in pyscript
i would like to implement pyscript in html code, for instance i want to generate chart output, here is my code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta ...
0
votes
1
answer
108
views
how to display the results of a python program in a html files output [closed]
I'm trying to create an extension that searches google and allows the user to access the first 10 or so results.
I did the google search code in python and have the code for an extension but I don't ...
0
votes
1
answer
120
views
PyScript app that scapes text from the html of a inputted URL only refreshes page when submitted
I'm new to programming so I don't know how on or off the mark I am but either way I'm stuck.
I wanted to try making a webpage that uses a python script to scrape all the text from the html file of a ...
1
vote
1
answer
59
views
Chatbox does NOT work, after translation from Javascript to Pyscript
I had a chatbox in HTML created based on Javascript. Now I am trying to translate the Javascript code to Pyscript, to better streamline the data analytics tools. However, after the translation, the ...
1
vote
1
answer
696
views
Using files in Pyscript
I need to use some files in my Pyscript algorithm, and I know Pyscript can´t access local files because of a security issue. But my question is, can I somehow upload those files to a virtual file ...
1
vote
1
answer
139
views
Transfer data from Javascript to Pyscript
Im trying to build a website where you have a canvas, 28x28 sized and you draw a number. This is all handled through classic HTML, css and Javascript. Hovewever, once the image is drawn, I want to ...
1
vote
1
answer
80
views
How do I use Neo4j with Pyscript?
I want to have a webpage run the Python program that connects to a Neo4j Database. The code must be run on the clientside device, and for parity reasons rewriting the code to be not Python is ...
1
vote
1
answer
78
views
Python - I want to convert words to 8 bit binary, but certain characters are in 7 bits [duplicate]
I have a code (python) that converts any character on a keyboard to binary, but if the character has 2 zeros in the beginning of the binary code, it deletes 1 of the zeros, so it can't be converted ...
-2
votes
1
answer
74
views
while using py-script in html I am facing some issues [closed]
while using py-script in html i got this error:-
ERROR image you can check here by opening the link
i watched youtube videos but can't find any solution, i need to solve this error as soon as possible,...
0
votes
0
answers
96
views
Making a kind of a browser based Python IDLE that also allows the user of files
The title more or less tells it all. Ideally, I would like the html as self-sufficient as possible and definitely run the code in the browser. In addition, I would like be able to:
use files, ...
0
votes
1
answer
337
views
How do I display JSON data in HTML using Py-script and Pandas?
I'm working on this small project using JSON for the first time. This is also the first time I got back into programming in a while, so I'm a little rusty. Anyways, I've been trying to get Python to ...
-1
votes
1
answer
47
views
Problem with Pyscript libary installation
enter image description here
I added the needed google-generativeai but it still dosent work. Can someone help?
Here is the parts of thePy script enter image description here
Normaly the script should ...
0
votes
0
answers
175
views
Run python and get result as string in browser
I want to run Python code from a text-area in HTML and save the output in a div. I am using pyodide.js https://cdn.jsdelivr.net/pyodide/v0.25.0/full/pyodide.js to run Python. I would also like to use ...
0
votes
0
answers
74
views
How to convert HTML object to str object
Generally, str objects display on the console. How can I convert my html object to an str object so that it can display on the console?
x = HTML('<p>hello</p>')
string = str(x)
display(...
-1
votes
1
answer
47
views
Is there a way i can store html output inside a variable?
I am trying to store the html result inside a variable but it displays none.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Lively Forest</title>
<!-- ...
0
votes
0
answers
103
views
How to import sklearn in pyscript
The following is pyscript.toml and main.py in my project directory;
pyscript.toml
name = "scikit-learn and matplotlib"
packages = ["scikit-learn", "matplotlib"]
main.py
...
0
votes
1
answer
208
views
SSL module is not available error in python3 Windows 11
When running the FlightRadarAPI on python 3.12, windows 11 I'm getting an ImportError: Can't connect to HTTPS URL because the SSL module is not available.
Traceback (most recent call last):
File &...
-1
votes
1
answer
106
views
Problems with py script, pyodide, API and queries
I'm doing a project, I need to print a weather forecast, it doesn't seem to give out an error code, but the page is empty. Nothing is output your text
<!DOCTYPE html>
<html>
<head&...
0
votes
1
answer
1k
views
how do i make a interactive Pyscript terminal with input and output?
I want to host a python script on a website with pyscript, which has both console input and console output. how exactly do i do that?
i used https://pyscript.com/ to make the website and github pages ...
0
votes
1
answer
187
views
Disabled button event
I'm trying to get a button disabled when I press another button, but it's not working.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
...
1
vote
1
answer
353
views
How can I change elements with pyscript?
I want to make a button change color with pyscript. This code doesn't work.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta ...
0
votes
0
answers
57
views
Panorama Image in PyScript
I want to do a Panorama Image on a Html Side I already have a Python script running that makes a Panorama img realistic but now I am struggling to implement it on the html side. I hope somebody can ...
0
votes
1
answer
805
views
AttributeError in PyScript when using Panel
I am running Python via Pyscript and my code used to work fine for around 1 year. However its no longer working and I get the following error message
JsException(PythonError: Traceback (most recent ...
0
votes
0
answers
124
views
from panel.io.pyodide import show is obsolete
There was a working pyscript code that used the "show" function from the "panel.io.pyodide" library. After updating panel 24.10.23 the code stopped working. I am new to python. ...
0
votes
1
answer
93
views
How do I execute code sequentially in pyscript py-repl?
move()
if(character_data[0]['x']>=1):
say("Yes")
else:
say("NO")
I'm currently working with pyscript.
When you put the code above into a code block (py-repl) and run it,...