My quick hack for getting around the problem is to make a module called rprint which looks like this (I'm using python 3):
Then from every module where I have a print I say:from threading import Lock mylock = Lock() p = print def print(*a, **b): with mylock: p(*a, **b)
I don't know if this is an elegant solution or an ugly hack, but hey it works.from rprint import print