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

This commit is contained in:
Yen Chi Hsuan
2017-04-07 09:58:19 -07:00
committed by Brad Warren
parent d557c39c99
commit 4b91f7fbbc
3 changed files with 4 additions and 9 deletions
+1 -6
View File
@@ -192,12 +192,7 @@ def _choose_names_manually(prompt_prefix=""):
try: try:
domain_list[i] = util.enforce_domain_sanity(domain) domain_list[i] = util.enforce_domain_sanity(domain)
except errors.ConfigurationError as e: except errors.ConfigurationError as e:
try: # Python 2 invalid_domains[domain] = str(e)
# pylint: disable=no-member
err_msg = e.message.encode('utf-8')
except AttributeError:
err_msg = str(e)
invalid_domains[domain] = err_msg
if len(invalid_domains): if len(invalid_domains):
retry_message = ( retry_message = (
+2 -2
View File
@@ -571,7 +571,7 @@ def revoke(config, unused_plugins): # TODO: coop with renewal config
try: try:
acme.revoke(jose.ComparableX509(cert), config.reason) acme.revoke(jose.ComparableX509(cert), config.reason)
except acme_errors.ClientError as e: except acme_errors.ClientError as e:
return e.message return str(e)
display_ops.success_revocation(config.cert_path[0]) 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: try:
installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run") installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
except errors.PluginSelectionError as e: except errors.PluginSelectionError as e:
return e.message return str(e)
# TODO: Handle errors from _init_le_client? # TODO: Handle errors from _init_le_client?
le_client = _init_le_client(config, authenticator, installer) le_client = _init_le_client(config, authenticator, installer)
+1 -1
View File
@@ -79,7 +79,7 @@ def _reconstitute(config, full_path):
except (ValueError, errors.Error) as error: except (ValueError, errors.Error) as error:
logger.warning( logger.warning(
"An error occurred while parsing %s. The error was %s. " "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()) logger.debug("Traceback was:\n%s", traceback.format_exc())
return None return None