Skip to content

Commit

Permalink
Text input is dynamic and needs to be set at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Jan 16, 2025
1 parent eea6be2 commit 8c5c5ca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ createApp({
env: {
'FILES_INPUT_LOCATION': this.filesInputLocation,
'FILES_OUTPUT_LOCATION': this.filesOutputLocation,
'TEXT_INPUT': this.textInput
}
})
this.pyodide = pyodide
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8c5c5ca

Please sign in to comment.