diff --git a/src/formdefinition.py b/src/formdefinition.py index 64b06d4..f8525b4 100644 --- a/src/formdefinition.py +++ b/src/formdefinition.py @@ -84,7 +84,7 @@ class FormDefinition(object): value = self._field_validate(field_name, form_values) if value is not None: values[field_name] = value - except ValidationError, err: + except ValidationError as err: errors.setdefault(field_name, []).append(str(err)) return (errors, values) diff --git a/src/scriptform.py b/src/scriptform.py index c8a1943..c64f21e 100755 --- a/src/scriptform.py +++ b/src/scriptform.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Scriptform roughly works like this: @@ -234,14 +234,14 @@ def main(): # pragma: no cover elif options.action_stop: daemon.stop() sys.exit(0) - except socket.error, err: + except socket.error as err: log.exception(err) sys.stderr.write("Cannot bind to port {}: {}\n".format( options.port, str(err) )) sys.exit(2) - except Exception, err: + except Exception as err: log.exception(err) raise diff --git a/src/webserver.py b/src/webserver.py index 436b43a..cecf771 100644 --- a/src/webserver.py +++ b/src/webserver.py @@ -95,7 +95,7 @@ class RequestHandler(BaseHTTPRequestHandler): else: raise HTTPError(404, "Not found") method_cb(**params) - except HTTPError, err: + except HTTPError as err: # HTTP erors are generally thrown by the webapp on purpose. Send # error to the browser. if err.status_code not in (401, ): @@ -108,7 +108,7 @@ class RequestHandler(BaseHTTPRequestHandler): err.msg)) self.wfile.flush() return False - except Exception, err: + except Exception as err: self.scriptform.log.exception(err) self.send_error(500, "Internal server error") raise