prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Py Terminal issues aggregation
  ### Checklist
  
  - [X] I added a descriptive title
  - [X] I searched for other issues and couldn't find a solution or duplication
  - [X] I already searched in Google and didn't find any good information or help
  
  ### What happened?
  
  We have at least 3 issues in the current PyTerminal:
  
  - [x] errors (on main?) are actually not shown
  - [x] escape chars, **only on main**, are not recognized
  - [x] the config relative URL is resolved differently between main and worker ... this is probably not strictly related to PyTerminal but it's surely worth fixing this too because otherwise terminals can't easily switch from main to worker and/or vice-versa (see https://github.com/pyscript/polyscript/issues/77)
  
  ### What browsers are you seeing the problem on? (if applicable)
  
  _No response_
  
  ### Console info
  
  _No response_
  
  ### Additional Context
  
  _No response_
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pyscript.core/src/stdlib/pyscript/magic_js.py`
  Content:
  ```
  1 import sys
  2 
  3 import js as globalThis
  4 from polyscript import js_modules
  5 from pyscript.util import NotSupported
  6 
  7 RUNNING_IN_WORKER = not hasattr(globalThis, "document")
  8 
  9 
  10 # allow `from pyscript.js_modules.xxx import yyy`
  11 class JSModule(object):
  12     def __init__(self, name):
  13         self.name = name
  14 
  15     def __getattr__(self, field):
  16         # avoid pyodide looking for non existent fields
  17         if not field.startswith("_"):
  18             return getattr(getattr(js_modules, self.name), field)
  19 
  20 
  21 # generate N modules in the system that will proxy the real value
  22 for name in globalThis.Reflect.ownKeys(js_modules):
  23     sys.modules[f"pyscript.js_modules.{name}"] = JSModule(name)
  24 sys.modules["pyscript.js_modules"] = js_modules
  25 
  26 if RUNNING_IN_WORKER:
  27     import js
  28     import polyscript
  29 
  30     PyWorker = NotSupported(
  31         "pyscript.PyWorker",
  32         "pyscript.PyWorker works only when running in the main thread",
  33     )
  34     window = polyscript.xworker.window
  35     document = window.document
  36     js.document = document
  37     sync = polyscript.xworker.sync
  38 
  39     # in workers the display does not have a default ID
  40     # but there is a sync utility from xworker
  41     def current_target():
  42         return polyscript.target
  43 
  44 else:
  45     import _pyscript
  46     from _pyscript import PyWorker
  47 
  48     window = globalThis
  49     document = globalThis.document
  50     sync = NotSupported(
  51         "pyscript.sync", "pyscript.sync works only when running in a worker"
  52     )
  53 
  54     # in MAIN the current element target exist, just use it
  55     def current_target():
  56         return _pyscript.target
  57
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pyscript.core/src/stdlib/pyscript/magic_js.py b/pyscript.core/src/stdlib/pyscript/magic_js.py
  --- a/pyscript.core/src/stdlib/pyscript/magic_js.py
  +++ b/pyscript.core/src/stdlib/pyscript/magic_js.py
  @@ -8,7 +8,7 @@
   
   
   # allow `from pyscript.js_modules.xxx import yyy`
  -class JSModule(object):
  +class JSModule:
       def __init__(self, name):
           self.name = name
  
verification_info: {"golden_diff": "diff --git a/pyscript.core/src/stdlib/pyscript/magic_js.py b/pyscript.core/src/stdlib/pyscript/magic_js.py\n--- a/pyscript.core/src/stdlib/pyscript/magic_js.py\n+++ b/pyscript.core/src/stdlib/pyscript/magic_js.py\n@@ -8,7 +8,7 @@\n \n \n # allow `from pyscript.js_modules.xxx import yyy`\n-class JSModule(object):\n+class JSModule:\n     def __init__(self, name):\n         self.name = name\n", "issue": "Py Terminal issues aggregation\n### Checklist\r\n\r\n- [X] I added a descriptive title\r\n- [X] I searched for other issues and couldn't find a solution or duplication\r\n- [X] I already searched in Google and didn't find any good information or help\r\n\r\n### What happened?\r\n\r\nWe have at least 3 issues in the current PyTerminal:\r\n\r\n- [x] errors (on main?) are actually not shown\r\n- [x] escape chars, **only on main**, are not recognized\r\n- [x] the config relative URL is resolved differently between main and worker ... this is probably not strictly related to PyTerminal but it's surely worth fixing this too because otherwise terminals can't easily switch from main to worker and/or vice-versa (see https://github.com/pyscript/polyscript/issues/77)\r\n\r\n### What browsers are you seeing the problem on? (if applicable)\r\n\r\n_No response_\r\n\r\n### Console info\r\n\r\n_No response_\r\n\r\n### Additional Context\r\n\r\n_No response_\n", "before_files": [{"content": "import sys\n\nimport js as globalThis\nfrom polyscript import js_modules\nfrom pyscript.util import NotSupported\n\nRUNNING_IN_WORKER = not hasattr(globalThis, \"document\")\n\n\n# allow `from pyscript.js_modules.xxx import yyy`\nclass JSModule(object):\n    def __init__(self, name):\n        self.name = name\n\n    def __getattr__(self, field):\n        # avoid pyodide looking for non existent fields\n        if not field.startswith(\"_\"):\n            return getattr(getattr(js_modules, self.name), field)\n\n\n# generate N modules in the system that will proxy the real value\nfor name in globalThis.Reflect.ownKeys(js_modules):\n    sys.modules[f\"pyscript.js_modules.{name}\"] = JSModule(name)\nsys.modules[\"pyscript.js_modules\"] = js_modules\n\nif RUNNING_IN_WORKER:\n    import js\n    import polyscript\n\n    PyWorker = NotSupported(\n        \"pyscript.PyWorker\",\n        \"pyscript.PyWorker works only when running in the main thread\",\n    )\n    window = polyscript.xworker.window\n    document = window.document\n    js.document = document\n    sync = polyscript.xworker.sync\n\n    # in workers the display does not have a default ID\n    # but there is a sync utility from xworker\n    def current_target():\n        return polyscript.target\n\nelse:\n    import _pyscript\n    from _pyscript import PyWorker\n\n    window = globalThis\n    document = globalThis.document\n    sync = NotSupported(\n        \"pyscript.sync\", \"pyscript.sync works only when running in a worker\"\n    )\n\n    # in MAIN the current element target exist, just use it\n    def current_target():\n        return _pyscript.target\n", "path": "pyscript.core/src/stdlib/pyscript/magic_js.py"}], "after_files": [{"content": "import sys\n\nimport js as globalThis\nfrom polyscript import js_modules\nfrom pyscript.util import NotSupported\n\nRUNNING_IN_WORKER = not hasattr(globalThis, \"document\")\n\n\n# allow `from pyscript.js_modules.xxx import yyy`\nclass JSModule:\n    def __init__(self, name):\n        self.name = name\n\n    def __getattr__(self, field):\n        # avoid pyodide looking for non existent fields\n        if not field.startswith(\"_\"):\n            return getattr(getattr(js_modules, self.name), field)\n\n\n# generate N modules in the system that will proxy the real value\nfor name in globalThis.Reflect.ownKeys(js_modules):\n    sys.modules[f\"pyscript.js_modules.{name}\"] = JSModule(name)\nsys.modules[\"pyscript.js_modules\"] = js_modules\n\nif RUNNING_IN_WORKER:\n    import js\n    import polyscript\n\n    PyWorker = NotSupported(\n        \"pyscript.PyWorker\",\n        \"pyscript.PyWorker works only when running in the main thread\",\n    )\n    window = polyscript.xworker.window\n    document = window.document\n    js.document = document\n    sync = polyscript.xworker.sync\n\n    # in workers the display does not have a default ID\n    # but there is a sync utility from xworker\n    def current_target():\n        return polyscript.target\n\nelse:\n    import _pyscript\n    from _pyscript import PyWorker\n\n    window = globalThis\n    document = globalThis.document\n    sync = NotSupported(\n        \"pyscript.sync\", \"pyscript.sync works only when running in a worker\"\n    )\n\n    # in MAIN the current element target exist, just use it\n    def current_target():\n        return _pyscript.target\n", "path": "pyscript.core/src/stdlib/pyscript/magic_js.py"}]}