Pyscript in iframe (serverless) #2029
-
I'm trying to use pyscript in Iframe locally (no src domain, html injected on client side). Tried many things that didn't work. Right now I am creating the iframe like this:
commonpy.js:
Here's the error I get:
Can anyone tell me what's going on? Should I open a bug issue for this or am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Answered by
JeffersGlass
Apr 17, 2024
Replies: 1 comment 4 replies
-
I'm not sure if it's a bug or not, but using a const myHtml = `
<html lang="en"><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PyScript Offline</title>
<link rel="stylesheet" href="https://pyscript.net/releases/2024.4.1/core.css">
<script type="module" src="https://pyscript.net/releases/2024.4.1/core.js"></script>
</head>
<body>
<py-config>
[js_modules.main]
"http://localhost:5502/pyscript.core/test/commonpy.js" = "commonpy"
</py-config>
<script type="py">
from pyscript.js_modules import commonpy
commonpy.print('test 1')
import sys
from pyscript import window
window.console.log("console log")
commonpy.print('test 2')
</script>
</body></html>
`; |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
nvdid
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure if it's a bug or not, but using a
py-config
tag instead of an inline config does cure the symptoms: