[Distutils] distutils bug

Michael Foord Michael.Foord at tbsmerchants.co.uk
Mon Jan 17 12:58:23 CET 2005


I've had some problems with py2exe which I *think* highlights a bug in 
distutils.

I had a mysterious problems with py2exe causing a 'crash' - not an 
exception but a full on windows 'the memory  referenced could not be 
read' crash. I could reproduce this problem on two machines - (both 
windows XP) one with python 2.3 and another with python 2.4, however 
no-one else had the same problem.

In order to trace the exact point the crash was occurring I set the 
DISTUTILS_DEBUG environment variable.

The crash I was investigating then disapeared (I told you it was 
mysterious) - but I got a traceback from within distutils.

The traceback occurs within distutils.command.install - the 'dump_dirs' 
function in install.py.

The offending code is :
                    val = getattr(self, opt_name)
                    print "  %s: %s" % (opt_name, val)

when run from py2exe this causes an AttributeError for the 'no_compile' 
attribute.

If replaced with the following code, it works fine.

                try:
                    val = getattr(self, opt_name)
                except AttributeError:
                    print 'Attribute not found :', opt_name
                else:
                    print "  %s: %s" % (opt_name, val)

(This is for the Movable Python project - which works fine :-)

Regards,


Fuzzyman
http://www.voidspace.org.uk/python/index.shtml


More information about the Distutils-SIG mailing list