cprofiler with python api

cprofiler with python api

Anonymous
Not applicable
435 Views
0 Replies
Message 1 of 1

cprofiler with python api

Anonymous
Not applicable

Does anyone know how to set up profiler with the python api?

 

 

import cProfile
import adsk.core, adsk.fusion, traceback

def myrun(context):
    ### my code is here...

def run(context):
    try:    
        app = adsk.core.Application.get()
        ui  = app.userInterface
        myrun(context)
        cProfile.run("myrun(context)")
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

If i try this I get myrun is not defined, but the code truly ran by the function call myrun(context). What am I doing wrong?

Thank you!
fred

 

0 Likes
436 Views
0 Replies
Replies (0)