CLI error when log file can't be opened (#326)

This commit is contained in:
Adrian Sampson 2012-01-30 16:29:22 -08:00
parent f4dc13161c
commit 23e30bf72a
2 changed files with 7 additions and 2 deletions

View file

@ -580,7 +580,11 @@ def import_files(lib, paths, copy, write, autot, logpath, art, threaded,
# Open the log.
if logpath:
logpath = normpath(logpath)
logfile = open(syspath(logpath), 'a')
try:
logfile = open(syspath(logpath), 'a')
except IOError:
raise ui.UserError(u"could not open log file for writing: %s" %
displayable_path(logpath))
print >>logfile, 'import started', time.asctime()
else:
logfile = None

View file

@ -17,6 +17,8 @@ Changelog
to "Various Artists".
* The ``inline`` plugin now prints a more comprehensible error when exceptions
occur in Python snippets.
* A reasonable error message is now shown when the import log file cannot be
opened.
* Fix a bug in the ``rewrite`` plugin that broke the use of multiple rules for
a single field.
* Fix a crash with non-ASCII characters in bytestring metadata fields (e.g.,
@ -26,7 +28,6 @@ Changelog
* Fix a crash in the ``chroma`` plugin when the Acoustid database had no
recording associated with a fingerprint.
1.0b12 (January 16, 2012)
-------------------------