|
24 | 24 | "source": [ |
25 | 25 | "pyjs.js.Function(\"\"\"\n", |
26 | 26 | " globalThis[\"_window\"] = this || self || window;\n", |
27 | | - " const url = globalThis.origin + \"/roslib.js\"\n", |
| 27 | + " const currentScriptPath = self.location.pathname;\n", |
| 28 | + " // Calculate the base path by getting the directory part\n", |
| 29 | + " const basePath = currentScriptPath.substring(0, currentScriptPath.lastIndexOf('/'));\n", |
| 30 | + " \n", |
| 31 | + " // Now construct the URL relative to the current script\n", |
| 32 | + " const url = basePath + \"/roslib.js\";\n", |
28 | 33 | " console.log(url);\n", |
29 | 34 | " importScripts(url);\n", |
30 | | - "\"\"\")()\n", |
31 | | - "\n", |
32 | | - " \n", |
33 | | - "\n" |
| 35 | + "\"\"\")()" |
34 | 36 | ] |
35 | 37 | }, |
36 | 38 | { |
|
40 | 42 | "outputs": [], |
41 | 43 | "source": [ |
42 | 44 | "pyjs.js.Function(\"\"\"\n", |
43 | | - " const url = globalThis.origin + \"/pre.js\"\n", |
| 45 | + " const currentScriptPath = self.location.pathname;\n", |
| 46 | + " // Calculate the base path by getting the directory part\n", |
| 47 | + " const basePath = currentScriptPath.substring(0, currentScriptPath.lastIndexOf('/'));\n", |
| 48 | + " const url = basePath + \"/pre.js\"\n", |
44 | 49 | " console.log(url);\n", |
45 | 50 | " importScripts(url);\n", |
46 | 51 | "\"\"\")()" |
|
151 | 156 | ], |
152 | 157 | "metadata": { |
153 | 158 | "kernelspec": { |
154 | | - "display_name": "Python (XPython)", |
| 159 | + "display_name": "Python 3.11 (XPython)", |
155 | 160 | "language": "python", |
156 | | - "name": "xeus-python" |
| 161 | + "name": "xpython" |
157 | 162 | }, |
158 | 163 | "language_info": { |
159 | 164 | "file_extension": ".py", |
|
0 commit comments