diff --git a/readthedocs/api/base.py b/readthedocs/api/base.py index 4e3157ca39c..3d5893b2328 100644 --- a/readthedocs/api/base.py +++ b/readthedocs/api/base.py @@ -91,7 +91,7 @@ def sync_versions(self, request, **kwargs): self._sync_versions(project, data['tags']) self._sync_versions(project, data['branches']) deleted_versions = self._delete_versions(project, data) - except Exception, e: + except Exception as e: return self.create_response( request, {'exception': e.message}, diff --git a/readthedocs/api/utils.py b/readthedocs/api/utils.py index cc4c2810382..56ec26d94cb 100644 --- a/readthedocs/api/utils.py +++ b/readthedocs/api/utils.py @@ -165,7 +165,7 @@ def obj_get_list(self, request=None, *args, **kwargs): try: return self.get_object_list(request).filter(**applicable_filters) - except ValueError, e: + except ValueError as e: raise NotFound(ugettext("Invalid resource lookup data provided " "(mismatched type).: %(error)s") % {'error': e}) diff --git a/readthedocs/core/views.py b/readthedocs/core/views.py index f7a593fa504..6b49f11e2bc 100644 --- a/readthedocs/core/views.py +++ b/readthedocs/core/views.py @@ -191,7 +191,7 @@ def _build_url(url, branches): url, ' '.join(not_building)) pc_log.info(msg) return HttpResponse(msg) - except Exception, e: + except Exception as e: if e.__class__ == NoProjectException: raise msg = "(URL Build) Failed: %s:%s" % (url, e) diff --git a/readthedocs/oauth/migrations/0003_move_github.py b/readthedocs/oauth/migrations/0003_move_github.py index d739a48078a..dda92d0371c 100644 --- a/readthedocs/oauth/migrations/0003_move_github.py +++ b/readthedocs/oauth/migrations/0003_move_github.py @@ -108,7 +108,7 @@ def forwards_move_repos(apps, schema_editor): else: new_repo.clone_url = data.get('clone_url') new_repo.json = json.dumps(data) - except SyntaxError, ValueError: + except (SyntaxError, ValueError) as e: pass new_repo.save() log.info('Migrated project: %s', project.name) @@ -149,7 +149,7 @@ def forwards_move_repos(apps, schema_editor): new_repo.clone_url = clone_urls.get('ssh', project.git_url) else: new_repo.clone_url = clone_urls.get('https', project.html_url) - except SyntaxError, ValueError: + except (SyntaxError, ValueError) as e: pass new_repo.save() log.info('Migrated project: %s', project.name) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 81f548546a5..e6c8fdd095a 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -118,7 +118,7 @@ def run(self, pk, version_pk=None, build_pk=None, record=True, docker=False, _('Builds for this project are temporarily disabled')) try: self.setup_vcs() - except vcs_support_utils.LockTimeout, e: + except vcs_support_utils.LockTimeout as e: self.retry(exc=e, throw=False) raise BuildEnvironmentError( 'Version locked, retrying in 5 minutes.', @@ -452,7 +452,7 @@ def update_imported_docs(version_pk): try: api_v2.project(project.pk).sync_versions.post(version_post_data) - except Exception, e: + except Exception as e: print "Sync Versions Exception: %s" % e.message return ret_dict