findResource ( resource_name )
Return the location of the given resource.
It's convenient to store associated resource files (such as text files, or
image files) within the Python package that uses them. This
function will search the Python module path for these files, and return
the absolute location of the file within the file system.
For example, suppose the package SomePackage contains a module,
SomeModule.py , and an associated resource, SomeModule.txt . Then
findResource("SomePackage/SomeModule.txt") will return the absolute path
to the resource, which will look something like this:
/usr/local/lib/python/site-packages/SomePackage/SomeModule.txt
Exceptions
|
|
IOError( "Can't find file %s" % filename )
|
|