8000 `py-editor` shows error in `2024.5.1` · Issue #2056 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content
  • Insights
  • py-editor shows error in 2024.5.1 #2056
    @JeffersGlass

    Description

    @JeffersGlass

    Try the following:

    <script type="module" src="https://pyscript.net/releases/2024.5.1/core.js"></script>    
    <link rel="stylesheet" href="https://pyscript.net/releases/2024.5.1/core.css">
    <script type="py-editor">
      print("Hello!")
    </script>

    You will get an error

    Error: Traceback (most recent call last):
      File "/lib/python311.zip/_pyodide/_base.py", line 501, in eval_code
        .run(globals, locals)
         ^^^^^^^^^^^^^^^^^^^^
      File "/lib/python311.zip/_pyodide/_base.py", line 339, in run
        coroutine = eval(self.code, globals, locals)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "", line 32, in 
      File "/home/pyodide/pyscript/__init__.py", line 32, in 
        from pyscript.display import HTML, display
      File "/home/pyodide/pyscript/display.py", line 6, in 
        from pyscript.magic_js import current_target, document, window
      File "/home/pyodide/pyscript/magic_js.py", line 11, in 
        config = json.loads(globalThis.JSON.stringify(_config))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/lib/python311.zip/json/__init__.py", line 339, in loads
        raise TypeError(f'the JSON object must be str, bytes or bytearray, '
    TypeError: the JSON object must be str, bytes or bytearray, not NoneType
    
    Hello!
    

    If you use mpy-editor, a slightly different error occurs:

    Error: Traceback (most recent call last):
      File "", line 32, in 
      File "pyscript/__init__.py", line 32, in 
      File "pyscript/display.py", line 6, in 
      File "pyscript/magic_js.py", line 11, in 
    TypeError: object with buffer protocol required
    
    Hello!
    

    Note that in both cases, "Hello!" prints successfully.

    Maybe something related to trying to load a non-existent config?

    This does not occur with PyScript 2024.4.2.

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      No labels
      No labels

      Type

      No type

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        0