8000 Improve with string interpolations (#604) · gytdev/pyscript@9102768 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9102768

Browse files
authored
Improve with string interpolations (pyscript#604)
* Use string interpolations * Fix the key in py-env
1 parent 0c722b9 commit 9102768

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pyscriptjs/src/interpreter.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,12 @@ const loadFromFile = async function (s: string, runtime: PyodideInterface): Prom
4545
from js import console
4646
4747
try:
48-
response = await pyfetch("` +
49-
s +
50-
`")
48+
response = await pyfetch("${s}")
5149
except Exception as err:
52-
console.warn("PyScript: Access to local files (using 'Paths:' in py-env) is not available when directly opening a HTML file; you must use a webserver to serve the additional files. See https://github.com/pyscript/pyscript/issues/257#issuecomment-1119595062 on starting a simple webserver with Python.")
50+
console.warn("PyScript: Access to local files (using 'paths:' in py-env) is not available when directly opening a HTML file; you must use a webserver to serve the additional files. See https://github.com/pyscript/pyscript/issues/257#issuecomment-1119595062 on starting a simple webserver with Python.")
5351
raise(err)
5452
content = await response.bytes()
55-
with open("` +
56-
filename +
57-
`", "wb") as f:
53+
with open("${filename}", "wb") as f:
5854
f.write(content)
5955
`,
6056
);

0 commit comments

Comments
 (0)
0