Moved uuid import out of an except block