[py2exe] __debug__ = 0 - how?

F. GEIGER f.geiger at vol.at
Tue Jul 20 13:39:42 EDT 2004


I'd like to get rid of all __debug__ code fragments in my app. So I have 
changed the invocation of python to python -O in Windows Explorer. I use 
  a wx.TextCtrl to display th e__debug__ flag:

if __debug__:
    text = "__debug__ = 1"
else:
    text = "__debug__ = 0"

etc.

The control shows "__debug__ = 0" as expected.

When I build an exe file, __debug__ still seems to be on. Does py2exe 
switch -O off again or doesn't the -O get thru to py2exe? If so, does 
there exist a py2exe-option to switch on optimizing for exe files?

Kind regards
Franz GEIGER



More information about the Python-list mailing list