Hello!

 

I’m trying to include Excel into my wxPython program. If I try to create an executable with py2exe, I get an AttributeError:

xlNone, which comes from my Excel code chart.PlotArea.Interior.ColorIndex = constants.xlNone. So it’s seems to be that the

import from win32com.client import constants failed.

 

I tried to add the typelibs": [('{00020813-0000-0000-C000-000000000046}',0,1,4)] into my setup.py, but I get an

ImportError: No module named 00020813-0000-0000-C000-000000000046x0x1x3

 

Here is my setup.py.

 

Any help is very much appreciated.

Thanks in advance

Stefanie

 

 

from distutils.core import setup

import py2exe

import glob

import os

import zlib

import shutil

 

shutil.rmtree("build", ignore_errors=True)

shutil.rmtree("dist", ignore_errors=True)

 

MANIFEST_TEMPLATE = """

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <assemblyIdentity

    version="5.0.0.0"

    processorArchitecture="x86"

    name="%(prog)s"

    type="win32"

  />

  <description>%(prog)s</description>

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">

    <security>

      <requestedPrivileges>

        <requestedExecutionLevel

            level="asInvoker"

            uiAccess="false">

        </requestedExecutionLevel>

      </requestedPrivileges>

    </security>

  </trustInfo>

  <dependency>

<dependentAssembly>

<assemblyIdentity

type="win32"

name="Microsoft.VC90.CRT"

version="9.0.21022.8"

processorArchitecture="x86"

publicKeyToken="1fc8b3b9a1e18e3b"

/>

</dependentAssembly>

</dependency>

</assembly>

"""

 

class Target(object):

    """ A simple class that holds information on our executable file. """

    def __init__(self, **kw):

        """ Default class constructor. Update as you need. """

        self.__dict__.update(kw)

 

data_files = []

 

includes = []

excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',

            'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',

            'Tkconstants', 'Tkinter']

packages = []

dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',

                'tk84.dll']

icon_resources = []

bitmap_resources = []

other_resources = []

other_resources = [(24, 1, MANIFEST_TEMPLATE % dict(prog="MyAppName"))]

 

GUI2Exe_Target_1 = Target(

    # what to build

    script = "statistic_GUI.py",

    icon_resources = icon_resources,

    bitmap_resources = bitmap_resources,

    other_resources = other_resources,

    dest_base = "statistic",

    version = "0.1",

    company_name = "No Company",

    copyright = "No Copyrights",

    name = "Py2Exe Sample File"

    )

 

setup(

 

    data_files = data_files,

 

    options = {"py2exe": {"compressed": 2,

                          "optimize": 2,

                          "includes": includes,

                          "excludes": excludes,

                          "packages": packages,

                          "dll_excludes": dll_excludes,

                          "bundle_files": 2, # or 3 but do not use 1 it often causes problems

                          "dist_dir": "dist",

                          "xref": False,

                          "skip_archive": False,

                          "ascii": False,

                          "custom_boot_script": '',

                          "typelibs":[('{00020813-0000-0000-C000-000000000046}', 0, 1, 3)]

 

                         }

              },

 

    zipfile = "lib\library.zip",

    console = [],

    windows = [GUI2Exe_Target_1]

    )