1111
1212import requests
1313import toml
14+ import logging
1415
1516base_url = "https://api.comfy.org"
1617
@@ -23,7 +24,7 @@ async def get_cnr_data(cache_mode=True, dont_wait=True):
2324 try :
2425 return await _get_cnr_data (cache_mode , dont_wait )
2526 except asyncio .TimeoutError :
26- print ("A timeout occurred during the fetch process from ComfyRegistry." )
27+ logging . info ("A timeout occurred during the fetch process from ComfyRegistry." )
2728 return await _get_cnr_data (cache_mode = True , dont_wait = True ) # timeout fallback
2829
2930async def _get_cnr_data (cache_mode = True , dont_wait = True ):
@@ -79,12 +80,12 @@ async def fetch_all():
7980 full_nodes [x ['id' ]] = x
8081
8182 if page % 5 == 0 :
82- print (f"FETCH ComfyRegistry Data: { page } /{ sub_json_obj ['totalPages' ]} " )
83+ logging . info (f"FETCH ComfyRegistry Data: { page } /{ sub_json_obj ['totalPages' ]} " )
8384
8485 page += 1
8586 time .sleep (0.5 )
8687
87- print ("FETCH ComfyRegistry Data [DONE]" )
88+ logging . info ("FETCH ComfyRegistry Data [DONE]" )
8889
8990 for v in full_nodes .values ():
9091 if 'latest_version' not in v :
@@ -100,7 +101,7 @@ async def fetch_all():
100101 if cache_state == 'not-cached' :
101102 return {}
102103 else :
103- print ("[ComfyUI-Manager] The ComfyRegistry cache update is still in progress, so an outdated cache is being used." )
104+ logging . info ("[ComfyUI-Manager] The ComfyRegistry cache update is still in progress, so an outdated cache is being used." )
104105 with open (manager_util .get_cache_path (uri ), 'r' , encoding = "UTF-8" , errors = "ignore" ) as json_file :
105106 return json .load (json_file )['nodes' ]
106107
@@ -114,7 +115,7 @@ async def fetch_all():
114115 return json_obj ['nodes' ]
115116 except Exception :
116117 res = {}
117- print ("Cannot connect to comfyregistry." )
118+ logging . warning ("Cannot connect to comfyregistry." )
118119 finally :
119120 if cache_mode :
120121 is_cache_loading = False
@@ -240,7 +241,7 @@ def generate_cnr_id(fullpath, cnr_id):
240241 with open (cnr_id_path , "w" ) as f :
241242 return f .write (cnr_id )
242243 except Exception :
243- print (f"[ComfyUI Manager] unable to create file: { cnr_id_path } " )
244+ logging . error (f"[ComfyUI Manager] unable to create file: { cnr_id_path } " )
244245
245246
246247def read_cnr_id (fullpath ):
0 commit comments