@@ -73,10 +73,8 @@ async function generatePythonForModule(module: Module, storage: Storage): Promis
7373 const generatorContext = new GeneratorContext ( ) ;
7474 generatorContext . setModule ( module ) ;
7575
76- // Initialize the generator if not already done
77- if ( ! extendedPythonGenerator . isInitialized ) {
78- extendedPythonGenerator . init ( workspace ) ;
79- }
76+ // Initialize the generator
77+ extendedPythonGenerator . init ( workspace ) ;
8078
8179 // Generate Python code using the same method as the editor
8280 const pythonCode = extendedPythonGenerator . mrcWorkspaceToCode ( workspace , generatorContext ) ;
@@ -170,12 +168,8 @@ async function generatePythonFilesMap(project: Project, storage: Storage): Promi
170168 * @returns Promise that resolves to a blob URL for downloading the zip file
171169 */
172170export async function producePythonProjectBlob ( project : Project , storage : Storage ) : Promise < string > {
173- // Initialize the generator first
174- initializeHeadlessBlockly ( ) ;
175-
176171 const pythonFilesMap = await generatePythonFilesMap ( project , storage ) ;
177172
178-
179173 if ( pythonFilesMap . size === 0 ) {
180174 throw new Error ( 'No Python files were generated successfully' ) ;
181175 }
@@ -189,13 +183,3 @@ export async function producePythonProjectBlob(project: Project, storage: Storag
189183 const blobUrl = URL . createObjectURL ( content ) ;
190184 return blobUrl ;
191185}
192-
193- /**
194- * Initialize Blockly for headless operation
195- * This should be called once before using the generation functions
196- */
197- function initializeHeadlessBlockly ( ) : void {
198- // Initialize Blockly for headless operation
199- // This ensures all necessary generators and blocks are loaded
200- extendedPythonGenerator . init ( new Blockly . Workspace ( ) ) ;
201- }
0 commit comments