SamG wrote: > If a function does not have main function defined and there is only a > > if __name__="__main__": > > how do i make a call to that using > > profile.runcall( ...) > > in my profiling script. Is there a way to find the entry point of a > script and indentify it with module method. > There is no way to do that without modifying your module (by the way, I think you should have said "If a *module* does not ...").
The easiest way to do this is to replace the line if __name == "__main__: with def main(): and then at the end of the module put if __name__ == "__main__": main() The second step is not required unless you still want the module to run as a standalone script. Now you can call profile.runcall(module.main, ...) regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Recent Ramblings http://holdenweb.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list