@@ -128,7 +128,6 @@ print(f"Python version: {sys.version}")
128128 }
129129
130130 Future <void > _waitForPyodide () async {
131- // TODO
132131 var attempts = 0 ;
133132 while (attempts < 100 ) {
134133 if (js_util.hasProperty (js_util.globalThis, 'loadPyodide' )) {
@@ -232,7 +231,6 @@ if '/package' not in sys.path:
232231 @override
233232 Future <String ?> run (String appPath,
234233 {String ? script, List <String >? modulePaths, Map <String , String >? environmentVariables, bool ? sync }) async {
235- print (environmentVariables);
236234 try {
237235 await ensureInitialized (appPath);
238236
@@ -241,6 +239,8 @@ if '/package' not in sys.path:
241239
242240 // Set environment variables if provided
243241 if (environmentVariables != null ) {
242+ print ("Running python web command with environment variables: $environmentVariables " );
243+
244244 await _runPythonCode ('''
245245import os
246246${environmentVariables .entries .map ((e ) => "os.environ['${e .key }'] = '${e .value }'" ).join ('\n ' )}
@@ -255,17 +255,17 @@ ${environmentVariables.entries.map((e) => "os.environ['${e.key}'] = '${e.value}'
255255 print ("Loaded ${newNModules - oldNModules } new modules!" );
256256 }
257257
258- final String debugCode = '''
259- import os
260- import sys
261-
262- print("Python version:", sys.version)
263- print("Python path:", sys.path)
264- print("Current working directory:", os.getcwd())
265- print("Directory contents:", os.listdir('/package'))
266- ''' ;
258+ // final String debugCode = '''
259+ // import os
260+ // import sys
261+ //
262+ // print("Python version:", sys.version)
263+ // print("Python path:", sys.path)
264+ // print("Current working directory:", os.getcwd())
265+ // print("Directory contents:", os.listdir('/package'))
266+ // ''';
267267
268- await _runPythonCode (debugCode + pythonCode);
268+ await _runPythonCode (pythonCode);
269269
270270 final result = _pyodide! .globals.get ("pyodide_result" );
271271 return result.toString ();
@@ -277,7 +277,7 @@ print("Directory contents:", os.listdir('/package'))
277277
278278 Future <void > _runPythonCode (String code) async {
279279 try {
280- print ("Running Python code: \n $code " );
280+ // print("Running Python code: \n$code");
281281 final promise = _pyodide! .runPythonAsync (code);
282282 await js_util.promiseToFuture (promise);
283283 } catch (e) {
0 commit comments