Replace print with error

Replaced previous error statements using the "print" function with error statements using the "error" function.