No court shall impose a fine upon a juror, witness or other person, for disobedience of its process or any contempt, unless he be present in a court at the time, or shall have been served with a rule of the court, returnable to a time certain, requiring him to show cause why the fine should not be imposed, and shall have failed to appear and show cause.