From e2e4ae25adca8d60e00c865c94ec3f73f1539ec1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 15 Aug 2010 08:11:47 -0400 Subject: [PATCH] Log a warning (rather than raising a Failure) on glob-loading a non-curve --- doc/tutorial.txt | 2 +- hooke/plugin/playlist.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/tutorial.txt b/doc/tutorial.txt index 6bba6cb..51524b7 100644 --- a/doc/tutorial.txt +++ b/doc/tutorial.txt @@ -172,7 +172,7 @@ mylist.hkp`` or ``load_playlist mylist``, Hooke will add ``.hkp`` if necessary. If, generating the playlist, you are including by chance a non-force -curve file that Hooke cannot open, Hooke will print an error and +curve file that Hooke cannot open, Hooke will log a warning and continue on. Navigating the playlist diff --git a/hooke/plugin/playlist.py b/hooke/plugin/playlist.py index 80c22d2..afd2ef9 100644 --- a/hooke/plugin/playlist.py +++ b/hooke/plugin/playlist.py @@ -22,10 +22,12 @@ several associated :class:`hooke.command.Command`\s for handling """ import glob +import logging import os.path from ..command import Command, Argument, Failure from ..playlist import FilePlaylist +from ..curve import NotRecognized from . import Builtin @@ -302,7 +304,12 @@ Additional information for the input :class:`hooke.curve.Curve`. def _run(self, hooke, inqueue, outqueue, params): p = self._playlist(hooke, params) for path in sorted(glob.glob(params['input'])): - p.append_curve_by_path(path, params['info'], hooke=hooke) + try: + p.append_curve_by_path(path, params['info'], hooke=hooke) + except NotRecognized, e: + log = logging.getLogger('hooke') + log.warn(unicode(e)) + continue outqueue.put(p[-1]) class RemoveCommand (PlaylistCommand): -- 2.26.2