py2exe problem

Simon Brunning simon.brunning at gmail.com
Tue Jun 21 04:37:26 EDT 2005


On 6/21/05, Austin <austin at maxtronic.com.tw> wrote:
> I use py2exe to build python program to "aa.exe".
> If this program has a bug, after closed this program, it will show
> "aa.exe.log" in this folder.
> Is there any ways to avoid this log file?

It's probably best just have a try/except at the very top level of
your app that logs the exception the way you want it logged. So, if
you currently have:

if __name__ == '__main__':
   main()

you should instead have:

if __name__ == '__main__':
   try:
       main()
   except exception:
       print >> mylog, exception # or whatever...

You are free to ignore the exception altogether if you want to, but I
promise you, you don't want to. ;-)

-- 
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list