If any person, while in charge of a locomotive engine, whether the same be driven by steam, electricity or other motive power, running upon the railroad or traction lines of any corporation, or while acting as conductor or brakeman of any car or train of cars on such railroad or traction line, be intoxicated, he shall be deemed guilty of a misdemeanor, and, upon conviction thereof, shall be fined not exceeding $500 and imprisoned in the county jail not less than two nor more than twelve months; and for the second offense he shall be guilty of a felony, and, upon conviction, shall be confined in the penitentiary not less than one nor more than three years.