mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 11:15:36 -05:00
Improve with string interpolations (#604)
* Use string interpolations * Fix the key in py-env
This commit is contained in:
@@ -45,16 +45,12 @@ const loadFromFile = async function (s: string, runtime: PyodideInterface): Prom
|
||||
from js import console
|
||||
|
||||
try:
|
||||
response = await pyfetch("` +
|
||||
s +
|
||||
`")
|
||||
response = await pyfetch("${s}")
|
||||
except Exception as err:
|
||||
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.")
|
||||
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.")
|
||||
raise(err)
|
||||
content = await response.bytes()
|
||||
with open("` +
|
||||
filename +
|
||||
`", "wb") as f:
|
||||
with open("${filename}", "wb") as f:
|
||||
f.write(content)
|
||||
`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user