From c76ddd7da82054ac92eae149c3db0284b69669b3 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 27 Jun 2010 20:04:59 -0700 Subject: [PATCH] fix error when no logfile is given --- beets/ui.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/beets/ui.py b/beets/ui.py index bc2bb0c27..552f7dd86 100644 --- a/beets/ui.py +++ b/beets/ui.py @@ -322,6 +322,8 @@ def import_files(lib, paths, copy=True, write=True, autot=True, logpath=None): """ if logpath: logfile = open(logpath, 'w') + else: + logfile = None first = True for path in paths: @@ -341,7 +343,7 @@ def import_files(lib, paths, copy=True, write=True, autot=True, logpath=None): lib.add(item) lib.save() - if logpath: + if logfile: logfile.close() def list_items(lib, query, album):