From 9b3daeea013d6a35de3ba15f658cb9a37cb824ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 26 Mar 2015 12:04:05 +0100 Subject: [PATCH] Exception.message => str(Exception) --- src/octoprint/events.py | 2 +- src/octoprint/plugins/cura/__init__.py | 4 ++-- src/octoprint/printer/profile.py | 2 +- src/octoprint/server/api/printer.py | 4 ++-- src/octoprint/server/api/printer_profiles.py | 4 ++-- src/octoprint/server/util/sockjs.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/octoprint/events.py b/src/octoprint/events.py index e176b052..cbcbf3b8 100644 --- a/src/octoprint/events.py +++ b/src/octoprint/events.py @@ -305,7 +305,7 @@ class CommandTrigger(GenericEventListener): else: commandExecutioner(command) except subprocess.CalledProcessError, e: - self._logger.warn("Command failed with return code %i: %s" % (e.returncode, e.message)) + self._logger.warn("Command failed with return code %i: %s" % (e.returncode, str(e))) except Exception, ex: self._logger.exception("Command failed") diff --git a/src/octoprint/plugins/cura/__init__.py b/src/octoprint/plugins/cura/__init__.py index b2d29431..9209ada5 100644 --- a/src/octoprint/plugins/cura/__init__.py +++ b/src/octoprint/plugins/cura/__init__.py @@ -65,7 +65,7 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin, try: profile_dict = Profile.from_cura_ini(flask.request.values[input_upload_path]) except Exception as e: - return flask.make_response("Something went wrong while converting imported profile: {message}".format(e.message), 500) + return flask.make_response("Something went wrong while converting imported profile: {message}".format(str(e)), 500) elif input_name in flask.request.files: temp_file = tempfile.NamedTemporaryFile("wb", delete=False) @@ -75,7 +75,7 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin, upload.save(temp_file.name) profile_dict = Profile.from_cura_ini(temp_file.name) except Exception as e: - return flask.make_response("Something went wrong while converting imported profile: {message}".format(e.message), 500) + return flask.make_response("Something went wrong while converting imported profile: {message}".format(str(e)), 500) finally: os.remove(temp_file) diff --git a/src/octoprint/printer/profile.py b/src/octoprint/printer/profile.py index 2c9363ef..547e81df 100644 --- a/src/octoprint/printer/profile.py +++ b/src/octoprint/printer/profile.py @@ -310,7 +310,7 @@ class PrinterProfileManager(object): try: yaml.safe_dump(profile, f, default_flow_style=False, indent=" ", allow_unicode=True) except Exception as e: - raise SaveError("Cannot save profile %s: %s" % (profile["id"], e.message)) + raise SaveError("Cannot save profile %s: %s" % (profile["id"], str(e))) def _remove_from_path(self, path): try: diff --git a/src/octoprint/server/api/printer.py b/src/octoprint/server/api/printer.py index e260c762..4d085950 100644 --- a/src/octoprint/server/api/printer.py +++ b/src/octoprint/server/api/printer.py @@ -135,7 +135,7 @@ def printerToolCommand(): try: printer.flow_rate(factor) except ValueError as e: - return make_response("Invalid value for flow rate: %s" % e.message, 400) + return make_response("Invalid value for flow rate: %s" % str(e), 400) return NO_CONTENT @@ -273,7 +273,7 @@ def printerPrintheadCommand(): try: printer.feed_rate(factor) except ValueError as e: - return make_response("Invalid value for feed rate: %s" % e.message, 400) + return make_response("Invalid value for feed rate: %s" % str(e), 400) return NO_CONTENT diff --git a/src/octoprint/server/api/printer_profiles.py b/src/octoprint/server/api/printer_profiles.py index e7c1e7c8..4f46a6b0 100644 --- a/src/octoprint/server/api/printer_profiles.py +++ b/src/octoprint/server/api/printer_profiles.py @@ -65,7 +65,7 @@ def printerProfilesAdd(): except CouldNotOverwriteError: return make_response("Profile already exists and overwriting was not allowed", 400) except Exception as e: - return make_response("Could not save profile: %s" % e.message, 500) + return make_response("Could not save profile: %s" % str(e), 500) else: return jsonify(dict(profile=_convert_profile(saved_profile))) @@ -118,7 +118,7 @@ def printerProfilesUpdate(identifier): except CouldNotOverwriteError: return make_response("Profile already exists and overwriting was not allowed", 400) except Exception as e: - return make_response("Could not save profile: %s" % e.message, 500) + return make_response("Could not save profile: %s" % str(e), 500) else: return jsonify(dict(profile=_convert_profile(saved_profile))) diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py index deffe1c1..186e55b3 100644 --- a/src/octoprint/server/util/sockjs.py +++ b/src/octoprint/server/util/sockjs.py @@ -141,4 +141,4 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection, octoprint.printer. try: self.send({type: payload}) except Exception as e: - self._logger.warn("Could not send message to client %s: %s" % (self._remoteAddress, e.message)) + self._logger.warn("Could not send message to client %s: %s" % (self._remoteAddress, str(e)))