Skip to content

setuptools error when embbeding it into a frozen executable #841

@nicoddemus

Description

@nicoddemus

Hi,

We distribute our applications in Windows and Linux using cx-freeze.

Recently we upgraded mock from 1.0.1 to 1.4.0, and one of the significant changes package-wise is that mock now uses setuptools to determine its __version__ attribute.

Packaging setuptools inside a frozen application poses a problem though: this code from setuptools.sandbox fails with an AssertionError:

try: from win32com.client.gencache import GetGeneratePath _EXCEPTIONS.append(GetGeneratePath()) del GetGeneratePath except ImportError: # it appears pywin32 is not installed, so no need to exclude. pass

The problem is that GetGeneratePath() fails with an AssertionError when called from a frozen application because the module is on a read-only store (the zipfile with all python modules):

def GetGeneratePath(): """...""" assert not is_readonly, "Why do you want the genpath for a readonly store?"

As a workaround which seems to work for us, we monkeypatched win32com.client.gencache.GetGeneratePath to always raise an ImportError when the application is frozen so the error is handled by setuptools.sandbox, but I'm not sure if there are any ramifications that we are not seeing of that.

Any thoughts or advice on this issue would be really appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions