#NEWLINE# def run_script( mayavi , script_name ) : #NEWLINE# #INDENT# 'Execfiles a given script.  The name `mayavi` is bound to the\n    mayavi script instance just like in the embedded interpreter.\n    `script_name` is the name of the script to execute.\n\n    Note that this function uses `execfile`. You should be careful\n    when using this.\n\n    It returns `False` if everything was OK and `True` if not.\n    ' #NEWLINE# from mayavi.core.common import exception #NEWLINE# g = sys . modules [ '__main__' ] . __dict__ #NEWLINE# if ( 'mayavi' not in g ) : #NEWLINE# #INDENT# g [ 'mayavi' ] = mayavi #NEWLINE# g [ 'engine' ] = mayavi . engine #NEWLINE# #UNINDENT# g [ '__file__' ] = script_name #NEWLINE# error = False #NEWLINE# try : #NEWLINE# #INDENT# exec ( compile ( open ( script_name ) . read ( ) , script_name , 'exec' ) , g , g ) #NEWLINE# #UNINDENT# except Exception as msg : #NEWLINE# #INDENT# exception ( str ( msg ) ) #NEWLINE# error = True #NEWLINE# #UNINDENT# return error