Q:

Remember exceptions raised to handle them later

TLDR: I'd like to be let a function run through certain exceptions, display them at the end and make the function raise an exception.
I am building a function (see below) to get the path to each value in a dictionary, by creating a dictionary of the form "value":"path". I have a recursive sub-function traversing the dictionary doing processing on each node, throwing a TypeError when a node isn't of the supported types, and a KeyError when a value is already present.
What i'd like to do is to do the processing on the entire dictionary ignoring those exceptions and handle them only in the end, so that i can give the path to each problematic value. I want to save the flattened dictionary if no exception has been raised.
As it stands if i wrap a call to flatten_dict in a try...except block only the first exception is raised which would make changing all the problematic values tedious. I thought about using logging, but then i don't know how i can make the function still raise an exception at the end so that i can act accordingly.
I'm wondering if there's a way to do that, or if it's a sign i should change my design ?
Thanks
def flatten_dict(dictionary):
    """
    Flattens a dictionary to get the path to each value in the dict in dpath format (https://pypi.python.org/pypi/dpath/)
    Returns a dict of the form "value":"path"

    param: dictionary: the dictionary to be flattened, should contain each value only once, and all values should be strings

    >>> reverse_flatten_dict({"k1":{"k2":"v2", "k3":["v3","v4"]}})
    {"v2":"k1/k2","v3":"k1/k3/0","v4":"k1/k3/1"}
    """

    def recursive_call(value, path, flattened):
        """
        Recursively traverse the dictionary to add the path to each string \
        value it encounters to the flattened dict
        """
        if isinstance(value, dict):
            for key, val in value.items():
                new_path = "{}/{}".format(path,key)
                recursive_call(val, new_path, flattened)
        elif isinstance(value, list):
            for i, val in enumerate(value):
                new_path = "{}/{}".format(path,i)
                recursive_call(val, new_path, flattened)
        elif isinstance(value, basestring):
            if value in flattened:
                raise KeyError("flatten_dict: The value at {} is present more \
                than once in the dictionary".format(path))
            flattened[value] = path
        else:
            raise TypeError("flatten_dict: Value of invalid type at {},\
            value ignored. Should be dict, list or basestring".format(path))

    path = ""
    flattened = {}
    if dictionary:
        recursive_call(dictionary, path, flattened)

    return flattened

A:

There are probably better ways, but the simplest way to do this with minimum code adjustments would be to create an empty list above if dictionary:, pass it to the recursive function and just append any messages to it. Then at the end check if there were any and raise them as one exception. 
Example code: (note: I'm using Python 3, so I can't test this exact code. All the parts I added should work and the rest is copied from your post, so it should also work.)
def flatten_dict(dictionary):
    """
    Flattens a dictionary to get the path to each value in the dict in dpath format (https://pypi.python.org/pypi/dpath/)
    Returns a dict of the form "value":"path"

    param: dictionary: the dictionary to be flattened, should contain each value only once, and all values should be strings

    >>> reverse_flatten_dict({"k1":{"k2":"v2", "k3":["v3","v4"]}})
    {"v2":"k1/k2","v3":"k1/k3/0","v4":"k1/k3/1"}
    """

    def recursive_call(value, path, flattened, error_list):
        """
        Recursively traverse the dictionary to add the path to each string \
        value it encounters to the flattened dict
        """
        if isinstance(value, dict):
            for key, val in value.items():
                new_path = "{}/{}".format(path,key)
                recursive_call(val, new_path, flattened, error_list)
        elif isinstance(value, list):
            for i, val in enumerate(value):
                new_path = "{}/{}".format(path,i)
                recursive_call(val, new_path, flattened, error_list)
        elif isinstance(value, basestring):
            if value in flattened:
                error_list.append("flatten_dict: The value at {} is present more \
                    than once in the dictionary".format(path))
            flattened[value] = path
        else:
            error_list.append("flatten_dict: Value of invalid type at {},\
                value ignored. Should be dict, list or basestring".format(path))

    path = ""
    flattened = {}
    error_list = []
    if dictionary:
        recursive_call(dictionary, path, flattened, error_list)

    if error_list:
        # There was at least one error.
        error_list = ["Errors encountered while flattening:"] + error_list
        raise Exception('\n\t'.join(error_list))

    return flattened

Note that I don't really like this solution as you lose the exact type of error, as well as not raising the error where it occurs. Some kind of logging, or a flag indicating required behavior (ignore/log/exception) might be preferable, depending on your application and who'll be using it.

