@@ -128,7 +128,6 @@ print(f"Python version: {sys.version}")
128
128
}
129
129
130
130
Future <void > _waitForPyodide () async {
131
- // TODO
132
131
var attempts = 0 ;
133
132
while (attempts < 100 ) {
134
133
if (js_util.hasProperty (js_util.globalThis, 'loadPyodide' )) {
@@ -232,7 +231,6 @@ if '/package' not in sys.path:
232
231
@override
233
232
Future <String ?> run (String appPath,
234
233
{String ? script, List <String >? modulePaths, Map <String , String >? environmentVariables, bool ? sync }) async {
235
- print (environmentVariables);
236
234
try {
237
235
await ensureInitialized (appPath);
238
236
@@ -241,6 +239,8 @@ if '/package' not in sys.path:
241
239
242
240
// Set environment variables if provided
243
241
if (environmentVariables != null ) {
242
+ print ("Running python web command with environment variables: $environmentVariables " );
243
+
244
244
await _runPythonCode ('''
245
245
import os
246
246
${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}'
255
255
print ("Loaded ${newNModules - oldNModules } new modules!" );
256
256
}
257
257
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
+ // ''';
267
267
268
- await _runPythonCode (debugCode + pythonCode);
268
+ await _runPythonCode (pythonCode);
269
269
270
270
final result = _pyodide! .globals.get ("pyodide_result" );
271
271
return result.toString ();
@@ -277,7 +277,7 @@ print("Directory contents:", os.listdir('/package'))
277
277
278
278
Future <void > _runPythonCode (String code) async {
279
279
try {
280
- print ("Running Python code: \n $code " );
280
+ // print("Running Python code: \n$code");
281
281
final promise = _pyodide! .runPythonAsync (code);
282
282
await js_util.promiseToFuture (promise);
283
283
} catch (e) {
0 commit comments