Actually, this isn't black and white. When I need to create more than one exception class for a library, I prefer to avoid subclassing standard exceptions to prevent that kind of confusing situation:
try:
afile = open('myfile.txt')
content = afile.read()
my_library.do_something(content)
except IOError:
# recover from afile.read() failure
If my_library was returning a IOError, you would not know if the problem came from your code or the library code. Moreover, this would leak implementation detail.Of course, you can always get around this by wrapping each library call within a try/catch block, but that does not scale well if you make many calls interspersed with your code.