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

With the new development snapshot, web workers no longer work in my project

moepnse opened this issue · comments

Hello!

When I use the new development snapshot, web workers no longer work in my project.

...
        element = document.getElementById(wid)
        console.debug("element:", element)
        src = element.src
        console.debug("src:", src)
        worker.create_worker(wid, self.onready, self.onmessage, self.onerror)
...
element: 
<script id="webworker_82c5f471-0adf-47b1-8d1c-7bcc11aa54e6" class="webworker" type="text/python" src="/py/elephas/web_workers/formatter.py">
[brython.js:9555:30](http://localhost:8082/brython/snapshot/brython.js)
src: http://localhost:8082/py/elephas/web_workers/formatter.py [brython.js:9555:30](http://localhost:8082/brython/snapshot/brython.js)
handle error 
Object { __class__: {…}, __bases__: (1) […], __mro__: (3) […], __name__: "JavascriptError", __qualname__: "JavascriptError", "$is_class": true, "$factory": exc_class()
, __module__: "builtins", "$is_builtin_class": true }
 
Array [ "TypeError: src is undefined" ]
[brython.js:4496:43](http://localhost:8082/brython/snapshot/brython.js)
stack 
Array(9) [ (5) […], (4) […], (4) […], (4) […], (5) […], (5) […], (5) […], (5) […], (5) […] ]
[brython.js:4497:9](http://localhost:8082/brython/snapshot/brython.js)
make_builtin_exception/exc_class<@http://localhost:8082/brython/snapshot/brython.js:4220:57
$B.exception@http://localhost:8082/brython/snapshot/brython.js:4194:25
$B.set_exc@http://localhost:8082/brython/snapshot/brython.js:4066:54
$B.set_exc_and_trace@http://localhost:8082/brython/snapshot/brython.js:4067:45
$B.set_exc_and_leave@http://localhost:8082/brython/snapshot/brython.js:4069:45
__init__480@http://localhost:8082/brython/snapshot/brython.js line 5754 > Function:303:4
type.$call_no_new_init/<@http://localhost:8082/brython/snapshot/brython.js:2178:10
$B.$call/<@http://localhost:8082/brython/snapshot/brython.js:1603:52
onload491@http://localhost:8082/brython/snapshot/brython.js line 5754 > Function:555:208
DOMNode.__getattribute__/func/f1@http://localhost:8082/brython/snapshot/brython.js:10269:93
$B.dispatch_load_event@http://localhost:8082/brython/snapshot/brython.js:857:8
$B.ajax_load_script/req.onreadystatechange@http://localhost:8082/brython/snapshot/brython.js:1085:4
EventHandlerNonNull*$B.ajax_load_script@http://localhost:8082/brython/snapshot/brython.js:1082:1
$B.loop@http://localhost:8082/brython/snapshot/brython.js:1133:10
run_scripts@http://localhost:8082/brython/snapshot/brython.js:945:4
injectPythonScript@http://localhost:8082/brython/snapshot/brython.js:860:12
$B.parser.brython/inject_observer<@http://localhost:8082/brython/snapshot/brython.js:874:153
MutationCallback*$B.parser.brython@http://localhost:8082/brython/snapshot/brython.js:874:21
onload@http://localhost:8082/?brython-version=snapshot:1:8
ev.target.body.onload@http://localhost:8082/brython/snapshot/brython.js:843:34
EventHandlerNonNull*@http://localhost:8082/brython/snapshot/brython.js:843:1
EventListener.handleEvent*@http://localhost:8082/brython/snapshot/brython.js:840:17
@http://localhost:8082/brython/snapshot/brython.js:964:21
[brython.js:4498:9](http://localhost:8082/brython/snapshot/brython.js)
Traceback (most recent call last):
  File "?brython-version=snapshot", line 18, in onopen
    import elephas
  File "VFS.elephas/__init__.py", line 68, in <module>
    from . import ui
  File "[VFS.elephas.ui/__init__.py](chrome://devtools/content/webconsole/VFS.elephas.ui/__init__.py)", line 6, in <module>
    from . import splash
  File "VFS.elephas.ui.uiplugins.py", line 44, in <module>
    browser.aio.run(load_ui_plugins())
  File "VFS.elephas.ui.uiplugins.py", line 43, in load_ui_plugins
    UIPlugin.plugins_loaded()
  File "/py/elephas/plugins/ui/0_base_component.py", line 185, in register
    BaseComponent.register()
  File "/py/elephas/plugins/ui/0_base_component.py", line 129, in register
    Splash.hide_splash()
  File "VFS.stermi.webworker2.py", line 101, in onload
    self._workers.append(WWPoolWorker(wid,self))
  File "VFS.stermi.webworker2.py", line 49, in __init__
    worker.create_worker(wid,self.onready,self.onmessage,self.onerror)
JavascriptError: TypeError: src is undefined
$B.Parser@http://localhost:8082/brython/snapshot/brython.js:14725:1
$B.py2js@http://localhost:8082/brython/snapshot/brython.js:809:12
create_worker@http://localhost:8082/brython/snapshot/brython.js line 5724 > Function:181:17
$B.$call1/<@http://localhost:8082/brython/snapshot/brython.js:1610:35
$B.$call/<@http://localhost:8082/brython/snapshot/brython.js:1603:52
__init__480@http://localhost:8082/brython/snapshot/brython.js line 5754 > Function:298:99
type.$call_no_new_init/<@http://localhost:8082/brython/snapshot/brython.js:2178:10
$B.$call/<@http://localhost:8082/brython/snapshot/brython.js:1603:52
onload491@http://localhost:8082/brython/snapshot/brython.js line 5754 > Function:555:208
DOMNode.__getattribute__/func/f1@http://localhost:8082/brython/snapshot/brython.js:10269:93
$B.dispatch_load_event@http://localhost:8082/brython/snapshot/brython.js:857:8
$B.ajax_load_script/req.onreadystatechange@http://localhost:8082/brython/snapshot/brython.js:1085:4
EventHandlerNonNull*$B.ajax_load_script@http://localhost:8082/brython/snapshot/brython.js:1082:1
$B.loop@http://localhost:8082/brython/snapshot/brython.js:1133:10
run_scripts@http://localhost:8082/brython/snapshot/brython.js:945:4
injectPythonScript@http://localhost:8082/brython/snapshot/brython.js:860:12
$B.parser.brython/inject_observer<@http://localhost:8082/brython/snapshot/brython.js:874:153
MutationCallback*$B.parser.brython@http://localhost:8082/brython/snapshot/brython.js:874:21
onload@http://localhost:8082/?brython-version=snapshot:1:8
ev.target.body.onload@http://localhost:8082/brython/snapshot/brython.js:843:34
EventHandlerNonNull*@http://localhost:8082/brython/snapshot/brython.js:843:1
EventListener.handleEvent*@http://localhost:8082/brython/snapshot/brython.js:840:17
@http://localhost:8082/brython/snapshot/brython.js:964:21

Thanks in advance!

Sorry about that @moepnse ...