In a limited fashion, I'm wondering why it's so frowned upon to use a bare-except in Python.
I get that if I have a full program running and I do something like:
import sys
from application import program
try:
program.start()
except:
print >> sys.stderr, "It didn't work"
I'm suppressing vital information and getting no real output. But let's consider I'm doing an IO operation for configuration settings, and I have a template set of data to use if the configuration is non-existent or corrupt:
import os
from config import load_data
from template import save_data
dir = os.path.expanduser('~')
path = os.path.join(dir, 'config.txt')
try:
load_data(path)
except:
save_data(path)
I guess in this case, is it better to build in a custom exception that catches the operation so it provides more information to someone reading the code?