Getting py2exe to work with zope.interface

后端 未结 3 1481
星月不相逢
星月不相逢 2020-12-17 02:58

I have a Python app based on Twisted and PyGTK. Twisted itself depends on zope.interface, and I don\'t import it directly.

Unfortunately, when I try to run my app, t

3条回答
  •  情深已故
    2020-12-17 03:25

    I don't know if you ever solved this, or if it's even relevant to you anymore, but for future searchers, I found an easy way to fix the zope import problem here.

    Specifically, add an empty __init__.py file to the PYTHONDIR/Lib/site-packages/zope directory.

    I tested this with a twisted application, using this setup file:

    #!/usr/bin/env python
    '''
    File: setup.py
    Author: Spencer Rathbun
    Date: 07/24/2012
    Description: Setup file for py2exe, converts client python script into executable.
    '''
    from distutils.core import setup
    import py2exe
    
    INCLUDES = [
        ''
    ]
    
    PACKAGES = [
        'twisted'
    ]
    
    setup(
            name = 'client',
            description = '',
            version = '1.0',
    
            console = [
                {"script":"client.py",
                    "icon_resources":[
                        (1, "c:\python27\DLLs\py.ico")
                        ]
                    }
                ],
            zipfile = None,
    
            options = {"py2exe":
                {"compressed": 1,
                    "optimize": 1,
                    "ascii": 0,
                    "bundle_files": 1,
    
                    "packages": ','.join(PACKAGES),
                    "includes": ','.join(INCLUDES),
                    }
                }
            )
    

    Py2exe can use this to successfully create an executable for twisted now, since it depends upon zope.

提交回复
热议问题