@@ -153,31 +153,38 @@ def check_files(expected_files, expected_notebooks, project_id):
153153 text = True ,
154154 timeout = 60 ,
155155 ).stdout .splitlines ()
156+
157+ # Add error handling for malformed output
158+ try :
159+ separator = output .index ("---" )
160+ except ValueError :
161+ print (f"Warning: Malformed output from deepnote_check_notebooks.js for { url } " )
162+ print ("Output received:" , output )
163+ return
164+
165+ notebooks = set (output [:separator ])
166+ expected_notebooks = set (expected_notebooks )
167+ files = set (output [separator + 1 :])
168+ expected_files = set (expected_files )
169+
170+ if not expected_notebooks == notebooks :
171+ print (f"At { url } :" )
172+ if expected_notebooks - notebooks :
173+ print (f" Missing notebooks: { expected_notebooks - notebooks } " )
174+ if notebooks - expected_notebooks :
175+ print (f" Extra notebooks: { notebooks - expected_notebooks } " )
176+
177+ if not expected_files == files :
178+ if expected_files - files :
179+ print (f"Missing files: { expected_files - files } " )
180+ if files - expected_files :
181+ print (f"Extra files: { files - expected_files } " )
156182 except :
157183 print ("Failed to run node.js notebook check. Disabling these checks." )
158184 print ("See deepnote_check_notebooks.js for installation instructions." )
159185 check_deepnote_files = False
160186 return
161187
162- separator = output .index ("---" )
163- notebooks = set (output [:separator ])
164- expected_notebooks = set (expected_notebooks )
165- files = set (output [separator + 1 :])
166- expected_files = set (expected_files )
167-
168- if not expected_notebooks == notebooks :
169- print (f"At { url } :" )
170- if expected_notebooks - notebooks :
171- print (f" Missing notebooks: { expected_notebooks - notebooks } " )
172- if notebooks - expected_notebooks :
173- print (f" Extra notebooks: { notebooks - expected_notebooks } " )
174-
175- if not expected_files == files :
176- if expected_files - files :
177- print (f"Missing files: { expected_files - files } " )
178- if files - expected_files :
179- print (f"Extra files: { files - expected_files } " )
180-
181188
182189with open (Path (root ) / "Deepnote_workspace.txt" ) as workspace_file :
183190 workspace = workspace_file .read ()
0 commit comments