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):