diff --git a/gui/src/app/Scripting/Analysis/AnalysisPyWindow.tsx b/gui/src/app/Scripting/Analysis/AnalysisPyWindow.tsx index 7ce845a..f33db03 100644 --- a/gui/src/app/Scripting/Analysis/AnalysisPyWindow.tsx +++ b/gui/src/app/Scripting/Analysis/AnalysisPyWindow.tsx @@ -59,6 +59,7 @@ const AnalysisPyWindow: FunctionComponent = ({ loadsDraws: true, showsPlots: true, producesData: false, + filenameForErrors: FileNames.ANALYSISPYFILE, }, files, }); diff --git a/gui/src/app/Scripting/DataGeneration/DataPyWindow.tsx b/gui/src/app/Scripting/DataGeneration/DataPyWindow.tsx index 988c88a..3b5554e 100644 --- a/gui/src/app/Scripting/DataGeneration/DataPyWindow.tsx +++ b/gui/src/app/Scripting/DataGeneration/DataPyWindow.tsx @@ -45,6 +45,7 @@ const DataPyWindow: FunctionComponent = () => { loadsDraws: false, showsPlots: false, producesData: true, + filenameForErrors: FileNames.DATAPYFILE, }, }); }, diff --git a/gui/src/app/Scripting/pyodide/pyodideWorker.ts b/gui/src/app/Scripting/pyodide/pyodideWorker.ts index 4c0737f..bc76fc2 100644 --- a/gui/src/app/Scripting/pyodide/pyodideWorker.ts +++ b/gui/src/app/Scripting/pyodide/pyodideWorker.ts @@ -122,7 +122,10 @@ const run = async ( } setStatus("running"); - pyodide.runPython(script, { globals }); + await pyodide.runPythonAsync(script, { + globals, + filename: spPySettings.filenameForErrors, + }); succeeded = true; } catch (e: any) { console.error(e); diff --git a/gui/src/app/Scripting/pyodide/pyodideWorkerTypes.ts b/gui/src/app/Scripting/pyodide/pyodideWorkerTypes.ts index 9830344..abe63aa 100644 --- a/gui/src/app/Scripting/pyodide/pyodideWorkerTypes.ts +++ b/gui/src/app/Scripting/pyodide/pyodideWorkerTypes.ts @@ -8,6 +8,7 @@ export type PyodideRunSettings = Partial<{ loadsDraws: boolean; showsPlots: boolean; producesData: boolean; + filenameForErrors: string; }>; export type MessageToPyodideWorker = {