From 1ff96856e66e00bf88f7651c789a9fe8c9885a7c Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Sun, 27 Jan 2013 18:32:38 -0800 Subject: [PATCH] raise the correct error if the flac module won't work... warn when it is not available.. [git-p4: depot-paths = "//depot/": change = 1674] --- flac.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flac.py b/flac.py index 2c71f9a..578fb27 100644 --- a/flac.py +++ b/flac.py @@ -43,7 +43,12 @@ except OSError: array.array('h', [ inbuf[chanmap[x % nchan]][x / nchan] for x in xrange(blksize * nchan)]) -flaclib = CDLL('libFLAC.so') +try: + flaclib = CDLL('libFLAC.so') +except OSError, e: + import warnings + warnings.warn('libFLAC.so not installed. FLAC decoding not available.') + raise ImportError(str(e)) # Defines