the problem about the DLL file generate by py2exe
Diez B. Roggisch
deets at nospam.web.de
Thu Jun 26 07:52:52 EDT 2008
em00100 at hotmail.com wrote:
> Dear All,
>
> I have try to use the py2exe to compile the DLL file
>
> first i write the simple python script "test01.py":
> def test001():
> return 1
>
> then write the setup.py:
> # setup.py
> from distutils.core import setup
> import py2exe
> import sys
>
> 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 version info resources (Properties -- Version)
> self.version = "0.0.1"
> self.company_name = "Nil"
> self.copyright = "Nil"
> self.name = "test"
>
> testTK = Target(
> # used for the versioninfo resource
> description = "test app",
> # what to build
> modules = ["test01"],
> script = "test01.py",
> # specify which type of com server you want (exe and/or dll)
> create_exe = False,
> create_dll = True)
>
> #setup(windows=["hkcity_ide_main.py"])
> setup(
> name='Test',
> options={"py2exe": {"bundle_files": 1, }},
> zipfile=None,
> version='1.0',
> description='Test',
> author='',
> author_email='',
> url='',
> ctypes_com_server=[testTK],
> )
>
>
> and compile the it by the command:
>
> C:\Python25\python setup.py py2exe
>
>
> I use the script try to call the function "test001" in the "test01.py"
> from ctypes import *
> test01 = cdll.LoadLibrary("test01.dll")
> test001 = test01.test001
> print test01()
>
> However, this is out the error:
> AttributeError: function 'test001' not found
>
> Is it any problem when i define the function?
I guess you should define a python-function, inside which you call your
dll-function.
Diez
More information about the Python-list
mailing list