File tree Expand file tree Collapse file tree
eng/tools/azure-sdk-tools/azpysdk Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,7 +199,21 @@ def get_type_complete_score(
199199 f"Running verifytypes failed: { e .stderr } . See https://aka.ms/python/typing-guide for information."
200200 )
201201 return - 1.0
202- report = json .loads (e .output )
202+ try :
203+ report = json .loads (e .output )
204+ except (json .JSONDecodeError , TypeError ):
205+ logger .error (
206+ f"pyright --verifytypes exited with code 1 but did not produce valid JSON output.\n "
207+ f"stdout: { e .output } \n "
208+ f"stderr: { e .stderr } \n "
209+ f"Re-running without --outputjson for diagnostic output..."
210+ )
211+ non_json_commands = [c for c in commands [1 :] if c != "--outputjson" ] + ["--verbose" ]
212+ diag = self .run_venv_command (executable , non_json_commands , cwd , check = False )
213+ logger .error (f"Diagnostic pyright stdout:\n { diag .stdout } " )
214+ if diag .stderr :
215+ logger .error (f"Diagnostic pyright stderr:\n { diag .stderr } " )
216+ return - 1.0
203217 if check_pytyped :
204218 pytyped_present = report ["typeCompleteness" ].get ("pyTypedPath" , None )
205219 if not pytyped_present :
You can’t perform that action at this time.
0 commit comments