Replace e.message with str(e) for Python 3 compatibility (#4416)

This commit is contained in:
Yen Chi Hsuan 2017-04-08 00:58:19 +08:00 committed by Brad Warren
parent d557c39c99
commit 4b91f7fbbc
3 changed files with 4 additions and 9 deletions

View file

@ -192,12 +192,7 @@ def _choose_names_manually(prompt_prefix=""):
try:
domain_list[i] = util.enforce_domain_sanity(domain)
except errors.ConfigurationError as e:
try: # Python 2
# pylint: disable=no-member
err_msg = e.message.encode('utf-8')
except AttributeError:
err_msg = str(e)
invalid_domains[domain] = err_msg
invalid_domains[domain] = str(e)
if len(invalid_domains):
retry_message = (

View file

@ -571,7 +571,7 @@ def revoke(config, unused_plugins): # TODO: coop with renewal config
try:
acme.revoke(jose.ComparableX509(cert), config.reason)
except acme_errors.ClientError as e:
return e.message
return str(e)
display_ops.success_revocation(config.cert_path[0])
@ -583,7 +583,7 @@ def run(config, plugins): # pylint: disable=too-many-branches,too-many-locals
try:
installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
except errors.PluginSelectionError as e:
return e.message
return str(e)
# TODO: Handle errors from _init_le_client?
le_client = _init_le_client(config, authenticator, installer)

View file

@ -79,7 +79,7 @@ def _reconstitute(config, full_path):
except (ValueError, errors.Error) as error:
logger.warning(
"An error occurred while parsing %s. The error was %s. "
"Skipping the file.", full_path, error.message)
"Skipping the file.", full_path, str(error))
logger.debug("Traceback was:\n%s", traceback.format_exc())
return None