| # mission by Clouclou on IRC
import bpy
def dump_scripted_drivers(datablock):
    if datablock.animation_data is None:
        return
    for i in range(len(datablock.animation_data.drivers)):
        dr = datablock.animation_data.drivers[i]
        if dr.driver.type == 'SCRIPTED':
            print("bpy.data.objects[%r].animation_data.drivers[%d] about (%r,%d) expression = %r" % (
            datablock.name, i, dr.data_path, dr.array_index, dr.driver.expression))
def scan_action(action):
    # I think this function is actually useless.
    # While fcurves have a driver property, that's not where drivers seem to live.
    for i in range(len(action.fcurves)):
        fcurve = action.fcurves[i]
        if fcurve.driver is None:
            continue
        if fcurve.driver.type == 'SCRIPTED':
            if fcurve.driver.expression is None:
                continue
            print("bpy.data.actions[%r].fcurve[%d] about (%r,%d) driver.expression = %r" % (
                action.name, i, fcurve.data_path, fcurve.array_index, fcurve.driver.expression))
def scan_for_scripted_drivers():
    for obj in bpy.data.objects:
        dump_scripted_drivers(obj)
    for mat in bpy.data.materials:
        dump_scripted_drivers(mat)
    # what other datablocks would people put drivers on?
    # does any of this apply?
    for action in bpy.data.actions:
        scan_action(action)
scan_for_scripted_drivers()
 | 
Blender python API quick-start
Syntax highlighting by Pygments.