From 8c5c5ca873aa3ece656c3971dfbb145e84197841 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Thu, 16 Jan 2025 17:45:45 +0100 Subject: [PATCH] Text input is dynamic and needs to be set at runtime --- src/main.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index d95ed42..13141b0 100644 --- a/src/main.js +++ b/src/main.js @@ -40,7 +40,6 @@ createApp({ env: { 'FILES_INPUT_LOCATION': this.filesInputLocation, 'FILES_OUTPUT_LOCATION': this.filesOutputLocation, - 'TEXT_INPUT': this.textInput } }) this.pyodide = pyodide @@ -91,9 +90,12 @@ createApp({ this.outputFs = await this.pyodide.mountNativeFS(this.filesOutputLocation, dirHandle) } - let textInput = null if (this.isUsingTextInput) { - textInput = prompt('Provide text input here') + const textInput = prompt('Provide text input here') + await this.pyodide.runPython(` + import os + os.environ['TEXT_INPUT'] = '${this.textInput}' + `) } await this.pyodide.runPython(this.script)