brython-dev / brython

Brython (Browser Python) is an implementation of Python 3 running in the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Importing the 'html' module raises an error

epeios-q37 opened this issue · comments

Hello,

I have following error when importing the html module:

Traceback (most recent call last):
  File <string>, line 1, in <module>
  File VFS.html/__init__.py, line 6, in <module>
    from html.entities import html5 as _html5
JavascriptError: ReferenceError: SurrogatePair is not defined

To reproduce the error: https://brython.info/tests/editor.html?code=import%20html

Occurs with the development version too.

Merci !

got the same error

to reproduce :

<html> 
    <head> 
    <script type="text/javascript"
        src="https://cdn.jsdelivr.net/npm/brython@3.12.2/brython.min.js">
    </script>
    <script type="text/javascript"
        src="https://cdn.jsdelivr.net/npm/brython@3.12.2/brython_stdlib.js">
    </script>        


    </head> 
<body> 

<script type="text/python">
from browser import document
import html

document <= "Hello !"
</script>

</body> 

</html>

You are using the latest release, 3.12.2. The fix applies to the current development version, and will be available in the next release.

In the meantime you can use the development version instead of the current release

<script src="https://raw.githack.com/brython-dev/brython/master/www/src/brython.js"
        crossorigin="anonymous">
</script>
<script src="https://raw.githack.com/brython-dev/brython/master/www/src/brython_stdlib.js"
        crossorigin="anonymous">
</script>