Task #2192 Add error treatment to python scripts

- Added try-except blocks to python scripts. They are logging the
exceptions too.