rm_end_space.py - add detect system and exception catch.