File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77
88[project ]
99name = " spotPython"
10- version = " 0.14.6 "
10+ version = " 0.14.7 "
1111authors = [
1212 { name =" T. Bartz-Beielstein" , email =" tbb@bartzundbartz.de" }
1313]
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ def progress_bar(
1919 filename (str):
2020 If not None, write the progress bar to filename.
2121 """
22+ if filename is not None :
23+ # open the file in append mode
24+ file = open (filename , "a" )
2225 status = ""
2326 if y is not None :
2427 message = f"{ message } { y } "
@@ -30,8 +33,10 @@ def progress_bar(
3033 status = "Done...\r \n "
3134 block = int (round (bar_length * progress ))
3235 text = f"{ message } [{ '#' * block + '-' * (bar_length - block )} ] { progress * 100 :.2f} % { status } \r \n "
36+ if filename is not None :
37+ file .write (text )
38+ file .flush ()
3339 stdout .write (text )
3440 stdout .flush ()
3541 if filename is not None :
36- with open (filename , "a" ) as file :
37- file .write (text )
42+ file .close ()
You can’t perform that action at this time.
0 commit comments