Try except test for IOError and ValueError