Py2exe error messages

Giles Brown giles_brown at hotmail.com
Sun Nov 2 06:28:47 EST 2003


"Ray" <sunking77 at hotmail.com> wrote in message news:<mailman.322.1067729524.702.python-list at python.org>...
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
> 
> C:\Python22>python setup.py py2exe --icon EXE icon
> Traceback (most recent call last):
>   File "setup.py", line 7, in ?
>     scripts = ["wxApp1.py"],
>   File "C:\Python22\distutils\core.py", line 101, in setup
>     _setup_distribution = dist = klass(attrs)
>   File "C:\Python22\distutils\dist.py", line 130, in __init__
>     setattr(self, method_name, getattr(self.metadata, method_name))
> AttributeError: DistributionMetadata instance has no attribute
> 'get___doc__'
> 
> This is the error message I'm getting when I try to run

Hmmm.  Have you taken a good look at the distutils/dist.py code?

On my 2.2.2 installation the nearest match (which strangely isn't
line exactly on line 130) is this chunk of code:

"""
        # Store the distribution meta-data (name, version, author, and so
        # forth) in a separate object -- we're getting to have enough
        # information here (and enough command-line options) that it's
        # worth it.  Also delegate 'get_XXX()' methods to the 'metadata'
        # object in a sneaky and underhanded (but efficient!) way.
        self.metadata = DistributionMetadata()
        for basename in self.metadata._METHOD_BASENAMES:
            method_name = "get_" + basename
            setattr(self, method_name, getattr(self.metadata, method_name))
"""

Don't know if I'm teach grandma to suck eggs here, but this
code it constructing a metadata sub-object and "stealing" certain
"get" functions from it to pass off as its own.  The list of
attributes that it is prepared to get is taken from 
Distribution._METHOD_BASENAMES (in the same file).

Looking at the version of this from my installation I see:

'''
class DistributionMetadata:
    """Dummy class to hold the distribution meta-data: name, version,
    author, and so forth.
    """

    _METHOD_BASENAMES = ("name", "version", "author", "author_email",
                         "maintainer", "maintainer_email", "url",
                         "license", "description", "long_description",
                         "keywords", "platforms", "fullname", "contact",
                         "contact_email", "licence")
'''

This leads to the question where is the loop in the extract above
getting the "__doc__" from that is using to build the method name?

You may want to inspect your the distutils code in your python installation
(and maybe put a few print statements into it) to investigate.

Hope this helps.
Regards,
Giles




More information about the Python-list mailing list