def set_var(var, set_='""'):
    '''set var outside notebook'''
    if isinstance(set_, str):
        to_set = json.dumps(set_)
    elif isinstance(set_, dict) or isinstance(set_, list):
        try:
            to_set = json.dumps(set_)
        except ValueError:
            raise Exception('var not jsonable')
    else:
        raise Exception('var must be jsonable list or dict')

    os.environ['NBCONVERT_' + var] = to_set
def set_var ( var , set_ = '""' ) : if isinstance ( set_ , str ) : to_set = json . dumps ( set_ ) elif isinstance ( set_ , dict ) or isinstance ( set_ , list ) : try : to_set = json . dumps ( set_ ) except ValueError : raise Exception ( 'var not jsonable' ) else : raise Exception ( 'var must be jsonable list or dict' ) os . environ [ 'NBCONVERT_' + var ] = to_set
set var outside notebook