@@ -39,14 +39,14 @@ def print(self, str_, end=False):
3939 str_ += "\n "
4040 self ._last_time = 0
4141 if time .time () - self ._last_time >= self ._flush_intvl :
42- sys .stdout .write (f"\r { str_ } " )
42+ sys .stderr .write (f"\r { str_ } " )
4343 self ._last_time = time .time ()
44- sys .stdout .flush ()
44+ sys .stderr .flush ()
4545
4646
4747def _download (url , save_path , print_progress ):
4848 if print_progress :
49- print (f"Connecting to { url } ..." )
49+ print (f"Connecting to { url } ..." , file = sys . stderr )
5050
5151 with requests .get (url , stream = True , timeout = 15 ) as r :
5252 r .raise_for_status ()
@@ -62,7 +62,10 @@ def _download(url, save_path, print_progress):
6262 total_length = int (total_length )
6363 if print_progress :
6464 printer = _ProgressPrinter ()
65- print (f"Downloading { os .path .basename (save_path )} ..." )
65+ print (
66+ f"Downloading { os .path .basename (save_path )} ..." ,
67+ file = sys .stderr ,
68+ )
6669 for data in r .iter_content (chunk_size = 4096 ):
6770 dl += len (data )
6871 f .write (data )
@@ -95,17 +98,17 @@ def _extract_tar_file(file_path, extd_dir):
9598 try :
9699 f .extract (file , extd_dir )
97100 except KeyError :
98- print (f"File { file } not found in the archive." )
101+ print (f"File { file } not found in the archive." , file = sys . stderr )
99102 yield total_num , index
100103 except Exception as e :
101- print (f"An error occurred: { e } " )
104+ print (f"An error occurred: { e } " , file = sys . stderr )
102105
103106
104107def _extract (file_path , extd_dir , print_progress ):
105108 """extract"""
106109 if print_progress :
107110 printer = _ProgressPrinter ()
108- print (f"Extracting { os .path .basename (file_path )} " )
111+ print (f"Extracting { os .path .basename (file_path )} " , file = sys . stderr )
109112
110113 if zipfile .is_zipfile (file_path ):
111114 handler = _extract_zip_file
0 commit comments