fixes #4277 this time in pure python (no calls to bash)

THanks a lot Eric, oh my.. I even forgot to change 10 to 1000 !!
after all teaching you are doing I can only hope I will not make you regret it,
surely I enjoy learning from you