Update main.py

Fixed error related to conversion from exception to str.