Closed vmirly closed 7 years ago
thanks for the note Vahid. Quick question, which version of pyprind are you using that had this issue?
I installed the newest version using pip.
import pyprind
pyprind.__version__
'2.10.0'
I am using python 3.5, from Anaconda distribution.
Thanks, fixed that now.
Thank youSebastian,
however, there is still a problem (in version 2.11.0)
0% [## ] 100% | ETA: 00:00:02
2.11.0
Data: pert_IFACE/ Output: /Users/vahid/tahq/vggdescriptors/results.vgg-matchscores/pertGenderIFACE-genine-cross
0% [##############################] 100% | ETA: 00:00:00
The code is given below. I am printing some stuff before creating ProgBar object, but it gets mixed with progress-bar:
print(pyprind.__version__)
## Genuine Scores
for vggpath in ['pert_IFACE/', 'pert_ROC/']:
path = vggmain_path + vggpath
output_fname = vggmain_path + 'results.vgg-matchscores/' + outputnames[vggpath] + task
print('Data: {} Output: {}'.format(vggpath, output_fname))
#sys.stdout.flush()
subj_dict = get_subjdict(path)
subj_dict_orig = get_subjdict(vggmain_path + 'orig/')
n_subjects = let(list(subj_dict.keys()))
pbar = pyprind.ProgBar(n_subjects)
Thanks for the feedback. That's interesting. So I guess either
a) uncommenting
#sys.stdout.flush()
or b)
print('Data: {} Output: {}'.format(vggpath, output_fname), flush=True)
would solve the issue. Right now, pyprind is only flushing the output stream its actually using (by default, it's stderr since that what most people prefer so that they can redirect stdout to files without cluttering it up with progress bars).
In any case, flushing both stderr and stdout prior to initializing the progress bar seems reasonable to me, will make that change
I have seen when I am printing some messages using print() statement prior to creating object of pyprind.ProgBar, the process bar gets split into separate parts like example below:
In order to fix this, I had to manually flush the stdout with:
and that will fix it.
Just as a suggestion, it will be helpful to put the
sys.stdout.flush()
in the constructor to take care of it.