From 01fd368c9792dd9794684c0bddb553a4695572e6 Mon Sep 17 00:00:00 2001 From: Olivier Mangin Date: Sat, 19 Apr 2014 16:44:28 +0200 Subject: [PATCH] Fix import and except syntax for python3. --- pubs/beets_ui.py | 3 +-- pubs/commands/__init__.py | 28 ++++++++++++++-------------- pubs/commands/add_cmd.py | 2 +- pubs/commands/attach_cmd.py | 4 ++-- pubs/repo.py | 2 +- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/pubs/beets_ui.py b/pubs/beets_ui.py index bb839bc..1adf87a 100644 --- a/pubs/beets_ui.py +++ b/pubs/beets_ui.py @@ -18,8 +18,7 @@ import locale import sys -from . import p3 -from p3 import input +from .p3 import input class UserError(Exception): diff --git a/pubs/commands/__init__.py b/pubs/commands/__init__.py index a68ab16..60f514f 100644 --- a/pubs/commands/__init__.py +++ b/pubs/commands/__init__.py @@ -1,19 +1,19 @@ # core -import init_cmd -import add_cmd -import rename_cmd -import remove_cmd -import list_cmd +from . import init_cmd +from . import add_cmd +from . import rename_cmd +from . import remove_cmd +from . import list_cmd # doc -import attach_cmd -import open_cmd -import tag_cmd -import note_cmd +from . import attach_cmd +from . import open_cmd +from . import tag_cmd +from . import note_cmd # bulk -import export_cmd -import import_cmd +from . import export_cmd +from . import import_cmd # bonus -import websearch_cmd +from . import websearch_cmd -import edit_cmd -# import update_cmd +from . import edit_cmd +# from . import update_cmd diff --git a/pubs/commands/add_cmd.py b/pubs/commands/add_cmd.py index 69861e5..b12dcef 100644 --- a/pubs/commands/add_cmd.py +++ b/pubs/commands/add_cmd.py @@ -112,6 +112,6 @@ def command(args): try: p.docpath = docfile rp.push_paper(p) - except ValueError, v: + except ValueError as v: ui.error(v.message) ui.exit(1) diff --git a/pubs/commands/attach_cmd.py b/pubs/commands/attach_cmd.py index dc5e6bf..0ecf1d8 100644 --- a/pubs/commands/attach_cmd.py +++ b/pubs/commands/attach_cmd.py @@ -39,9 +39,9 @@ def command(args): pass # TODO warn if file does not exists paper.docpath = document rp.push_paper(paper, overwrite=True, event=False) - except ValueError, v: + except ValueError as v: ui.error(v.message) ui.exit(1) - except IOError, v: + except IOError as v: ui.error(v.message) ui.exit(1) diff --git a/pubs/repo.py b/pubs/repo.py index 3c2058a..1f21b70 100644 --- a/pubs/repo.py +++ b/pubs/repo.py @@ -3,7 +3,7 @@ from datetime import datetime from . import bibstruct from . import events -from datacache import DataCache +from .datacache import DataCache from .paper import Paper