obspy.core.util.base.getExampleFile

getExampleFile(filename)[source]

Function to find the absolute path of a test data file

The ObsPy modules are installed to a custom installation directory. That is the path cannot be predicted. This functions searches for all installed ObsPy modules and checks whether the file is in any of the “tests/data” subdirectories.

Parameters:filename A test file name to which the path should be returned.
Returns:Full path to file.

Example

>>> getExampleFile('slist.ascii')  
/custom/path/to/obspy/core/tests/data/slist.ascii
>>> getExampleFile('does.not.exists')  
Traceback (most recent call last):
...
IOError: Could not find file does.not.exists ...

This Page