diff --git a/bilby/core/sampler/ptemcee.py b/bilby/core/sampler/ptemcee.py index ba5a4bc54fd4da64a174e196c7cc6372d2725e56..4dc97a4aa03d8a5c69bf0aa2ac73bdb55c3a5984 100644 --- a/bilby/core/sampler/ptemcee.py +++ b/bilby/core/sampler/ptemcee.py @@ -905,21 +905,24 @@ def print_progress( convergence_inputs.niterations_per_check * iteration * sampler.nwalkers * sampler.ntemps) eval_timing = "{:1.2f}ms/ev".format(1e3 * ave_time_per_check / evals_per_check) - print( - "{}|{}|nc:{}|a0:{}|swp:{}|n:{}<{}|t{}|q:{}|{}".format( - iteration, - str(sampling_time).split(".")[0], - ncalls, - acceptance_str, - tswap_acceptance_str, - nsamples_effective, - convergence_inputs.nsamples, - tau_str, - Q_str, - eval_timing, - ), - flush=True, - ) + try: + print( + "{}|{}|nc:{}|a0:{}|swp:{}|n:{}<{}|t{}|q:{}|{}".format( + iteration, + str(sampling_time).split(".")[0], + ncalls, + acceptance_str, + tswap_acceptance_str, + nsamples_effective, + convergence_inputs.nsamples, + tau_str, + Q_str, + eval_timing, + ), + flush=True, + ) + except OSError as e: + logger.debug("Failed to print iteration due to :{}".format(e)) def calculate_tau_array(samples, search_parameter_keys, ci):