StringIO import try-catch