[Python-talk] cProfile
bruce.labitt at autoliv.com
bruce.labitt at autoliv.com
Thu Oct 15 11:46:13 EDT 2009
python-talk-bounces at dlslug.org wrote on 10/15/2009 10:10:37 AM:
> I just tried the following:
>
> import cProfile
> import tb_tcp_client # my filename, has a main() in it. runs.
> cProfile.run('tb_tcp_client.main()','tcpclientprof')
>
> and got
> NameError: name 'tb_tcp_client' is not defined
>
> Sometimes this can be soo confusing...
> If I run with 'main()', I get the same name error, i.e., 'main()' is not
> defined.
>
> -Bruce
Doh. This won't work in ipython at the command line. Works fine in my
program...
import cProfile
def main():
if __name__='__main__':
cProfile.run('main()','tcpclientprof')
Thanks for your help.
Bruce
******************************
Neither the footer nor anything else in this E-mail is intended to or constitutes an <br>electronic signature and/or legally binding agreement in the absence of an <br>express statement or Autoliv policy and/or procedure to the contrary.<br>This E-mail and any attachments hereto are Autoliv property and may contain legally <br>privileged, confidential and/or proprietary information.<br>The recipient of this E-mail is prohibited from distributing, copying, forwarding or in any way <br>disseminating any material contained within this E-mail without prior written <br>permission from the author. If you receive this E-mail in error, please <br>immediately notify the author and delete this E-mail. Autoliv disclaims all <br>responsibility and liability for the consequences of any person who fails to <br>abide by the terms herein. <br>
******************************
More information about the Python-talk
mailing list