Updated convert.py with try/except clause