OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

PyScript <script type="py-editor"> Error Unable to use SharedArrayBuffer due insecure environment

  • Thread starter Thread starter Leonard Alphonso
  • Start date Start date
L

Leonard Alphonso

Guest
I'm using PyScript to run a simple Python script in my HTML file to display a pandas DataFrame. However, I'm encountering an error related to SharedArrayBuffer due to an insecure environment.

Environment:


  • Running the application locally using VSCode Live Server.


  • PyScript version: 2024.6.2


  • Python library: pandas

Steps to Reproduce:


  1. Create an HTML file with the below code.


  2. Open the HTML file.


  3. run the py-editor code block


  4. Observe the error in the browser console.

Question:

How can I resolve this SharedArrayBuffer issue when running PyScript? image of the error

Below is my HTML code:

Code:
<!doctype html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <link rel="stylesheet" href="https://pyscript.net/releases/2024.6.2/core.css">
        <script type="module" src="https://pyscript.net/releases/2024.6.2/core.js"></script>

        <style>
            #loading { outline: none; border: none; background: transparent }
        </style>

        <script type="module">
            const loading = document.getElementById('loading');
            addEventListener('py:ready', () => loading.close());
            loading.showModal();
        </script>
        
        <py-config>
            packages = ["pandas"]
        </py-config>
    </head>

    <body>
        <dialog id="loading">
            <h1>Loading...</h1>
        </dialog>

        <script type="py-editor">df</script>

        <script type="py">
            import pandas as pd
            data = {
                'Name': ['Alice', 'Bob', 'Charlie'],
                'Age': [25, 30, 35],
                'City': ['New York', 'Los Angeles', 'Chicago']
            }
            df = pd.DataFrame(data)
        </script>

    </body>
</html>
<p>I'm using PyScript to run a simple Python script in my HTML file to display a pandas DataFrame. However, I'm encountering an error related to <code>SharedArrayBuffer</code> due to an insecure environment.</p>
<p><strong>Environment:</strong></p>
<ul>
<li><p>Running the application locally using VSCode Live Server.</p>
</li>
<li><p>PyScript version: 2024.6.2</p>
</li>
<li><p>Python library: pandas</p>
</li>
</ul>
<p><strong>Steps to Reproduce:</strong></p>
<ol>
<li><p>Create an HTML file with the below code.</p>
</li>
<li><p>Open the HTML file.</p>
</li>
<li><p>run the py-editor code block</p>
</li>
<li><p>Observe the error in the browser console.</p>
</li>
</ol>
<p><strong>Question:</strong></p>
<p>How can I resolve this <code>SharedArrayBuffer</code> issue when running PyScript? <a href="https://i.sstatic.net/r4IYCNkZ.png" rel="nofollow noreferrer">image of the error</a></p>
<p>Below is my HTML code:</p>
<pre><code><!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" href="https://pyscript.net/releases/2024.6.2/core.css">
<script type="module" src="https://pyscript.net/releases/2024.6.2/core.js"></script>

<style>
#loading { outline: none; border: none; background: transparent }
</style>

<script type="module">
const loading = document.getElementById('loading');
addEventListener('py:ready', () => loading.close());
loading.showModal();
</script>

<py-config>
packages = ["pandas"]
</py-config>
</head>

<body>
<dialog id="loading">
<h1>Loading...</h1>
</dialog>

<script type="py-editor">df</script>

<script type="py">
import pandas as pd
data = {
'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [25, 30, 35],
'City': ['New York', 'Los Angeles', 'Chicago']
}
df = pd.DataFrame(data)
</script>

</body>
</html>
</code></pre>
 

Latest posts

I
Replies
0
Views
1
Isaac P. Liu
I
U
Replies
0
Views
1
user3658366
U
G
Replies
0
Views
1
Giampaolo Levorato
G
M
Replies
0
Views
1
Marcelo Rodrigo Nascimento
M
Top