Skip to content

Commit aa5ea86

Browse files
author
Bastian Bechtold
committed
improves import error handling
no longer dies with a TypeError if _soundfile_data is empty, but falls back to the system library as it should.
1 parent e2b403e commit aa5ea86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

soundfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@
159159
raise OSError('no packaged library for this platform')
160160

161161
import _soundfile_data # ImportError if this doesn't exist
162-
_path = _os.path.dirname(_soundfile_data.__file__)
162+
_path = _os.path.dirname(_soundfile_data.__file__) # TypeError if __file__ is None
163163
_full_path = _os.path.join(_path, _packaged_libname)
164164
_snd = _ffi.dlopen(_full_path) # OSError if file doesn't exist or can't be loaded
165165

166-
except (OSError, ImportError):
166+
except (OSError, ImportError, TypeError):
167167
try: # system-wide libsndfile:
168168
_libname = _find_library('sndfile')
169169
if _libname is None:

0 commit comments

Comments
 (0)