Skip to content

Commit faf28a1

Browse files
committed
Update notebook
1 parent e20229e commit faf28a1

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

files/RosTest.ipynb

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
"source": [
2525
"pyjs.js.Function(\"\"\"\n",
2626
" 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",
2833
" console.log(url);\n",
2934
" importScripts(url);\n",
30-
"\"\"\")()\n",
31-
"\n",
32-
" \n",
33-
"\n"
35+
"\"\"\")()"
3436
]
3537
},
3638
{
@@ -40,7 +42,10 @@
4042
"outputs": [],
4143
"source": [
4244
"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",
4449
" console.log(url);\n",
4550
" importScripts(url);\n",
4651
"\"\"\")()"
@@ -151,9 +156,9 @@
151156
],
152157
"metadata": {
153158
"kernelspec": {
154-
"display_name": "Python (XPython)",
159+
"display_name": "Python 3.11 (XPython)",
155160
"language": "python",
156-
"name": "xeus-python"
161+
"name": "xpython"
157162
},
158163
"language_info": {
159164
"file_extension": ".py",

0 commit comments

Comments
 (0)