Registering DLL

Girish girish.cfc at gmail.com
Fri Jul 24 02:11:11 EDT 2009


Hello,

I am facing a problem while registering DLL(Dspace.dll).. I am getting
an error saying: "DLLRegisterServer inDspace.dll Failed. Return Code:
0x80040201"

I am using following piece of code to generate DLL:

########################################################

# This setup script builds a single-file Python inprocess COM server.
from distutils.core import setup
import py2exe
import sys

# If run without args, build executables, in quiet mode.
if len(sys.argv) == 1:
    sys.argv.append("py2exe")
    sys.argv.append("-q")

class Target:
    def __init__(self, **kw):
        self.__dict__.update(kw)
        # for the versioninfo resources
        self.version = "1.0"
        self.company_name = "None"
        self.copyright = "None"
        self.name = "API"

interp = Target(
    description = "COM server module",
    # what to build.  For COM servers, the module name (not the
    # filename) must be specified!
    modules = ["Dspace"],
    #script = ["Dspace"],
    # we only want the inproc server.
    create_exe = True,
    )

excludes = ["pywin", "pywin.debugger", "pywin.debugger.dbgcon",
            "pywin.dialogs", "pywin.dialogs.list", 'email.Generator',
'email.Iterators', 'email.Utils']

options = {
    "bundle_files": 1,
    "ascii": 1, # to make a smaller executable, don't include the
encodings
    "compressed": 1, # compress the library archive
    "excludes": excludes, # COM stuff we don't want
    }

setup(
    options = {"py2exe": options},
    zipfile = None, # append zip-archive to the executable.
    com_server = [interp],
    )
################################################################

I am trying to generate a DLL from Python COM server module. I am able
to register the module by running the python code, but when I generate
a DLL and then try to register it using Regsvr32 command, I am getting
above mentioned error

Please help me resolve this issue.

-Girish



More information about the Python-list mailing list