@@ -45,14 +45,20 @@ def python_run_middleware(
4545 Returns:
4646 MiddlewareResult with execution status and messages
4747 """
48+ console .info (f"[DEBUG] Entry point argument: { entrypoint } " )
4849 if not entrypoint :
50+ console .info ("[DEBUG] No entrypoint specified." )
4951 return MiddlewareResult (
5052 should_continue = False ,
5153 error_message = """No entrypoint specified. Please provide a path to a Python script.
5254Usage: `uipath run <entrypoint_path> <input_arguments> [-f <input_json_file_path>]`""" ,
5355 )
5456
57+ console .info (f"[DEBUG] Absolute path resolved: { os .path .abspath (entrypoint )} " )
58+ console .info (f"[DEBUG] File exists: { os .path .exists (entrypoint )} " )
59+
5560 if not os .path .exists (entrypoint ):
61+ console .info (f"[DEBUG] Script not found at path: { entrypoint } " )
5662 return MiddlewareResult (
5763 should_continue = False ,
5864 error_message = f"""Script not found at path { entrypoint } .
@@ -62,9 +68,15 @@ def python_run_middleware(
6268 try :
6369
6470 async def execute ():
65- context = UiPathRuntimeContext .from_config (
66- env .get ("UIPATH_CONFIG_PATH" , "uipath.json" )
67- )
71+
72+ config_path = env .get ("UIPATH_CONFIG_PATH" , "uipath.json" )
73+ console .info (f"[DEBUG] Using config path: { config_path } " )
74+ console .info (f"[DEBUG] Entrypoint argument: { entrypoint } " )
75+ console .info (f"[DEBUG] Entrypoint absolute path: { os .path .abspath (entrypoint ) if entrypoint else None } " )
76+ console .info (f"[DEBUG] Entrypoint exists: { os .path .exists (entrypoint ) if entrypoint else None } " )
77+ console .info (f"[DEBUG] Input: { input } " )
78+ context = UiPathRuntimeContext .from_config (config_path )
79+
6880 context .entrypoint = entrypoint
6981 context .input = input
7082 context .resume = resume
@@ -93,13 +105,15 @@ async def execute():
93105 return MiddlewareResult (should_continue = False )
94106
95107 except UiPathRuntimeError as e :
108+ console .info (f"[DEBUG][UiPathRuntimeError] { type (e ).__name__ } : { e } " )
96109 return MiddlewareResult (
97110 should_continue = False ,
98111 error_message = f"Error: { e .error_info .title } - { e .error_info .detail } " ,
99112 should_include_stacktrace = False ,
100113 )
101114 except Exception as e :
102115 # Handle unexpected errors
116+ console .info (f"[DEBUG][Exception] { type (e ).__name__ } : { e } " )
103117 return MiddlewareResult (
104118 should_continue = False ,
105119 error_message = f"Error: Unexpected error occurred - { str (e )} " ,
0 commit comments