{"action":"opened","issue":{"url":"https://api.github.com/repos/pypa/setuptools/issues/841","repository_url":"https://api.github.com/repos/pypa/setuptools","labels_url":"https://api.github.com/repos/pypa/setuptools/issues/841/labels{/name}","comments_url":"https://api.github.com/repos/pypa/setuptools/issues/841/comments","events_url":"https://api.github.com/repos/pypa/setuptools/issues/841/events","html_url":"https://github.com/pypa/setuptools/issues/841","id":188040172,"number":841,"title":"setuptools error when embbeding it into a frozen executable","user":{"login":"nicoddemus","id":1085180,"avatar_url":"https://avatars.githubusercontent.com/u/1085180?v=3","gravatar_id":"","url":"https://api.github.com/users/nicoddemus","html_url":"https://github.com/nicoddemus","followers_url":"https://api.github.com/users/nicoddemus/followers","following_url":"https://api.github.com/users/nicoddemus/following{/other_user}","gists_url":"https://api.github.com/users/nicoddemus/gists{/gist_id}","starred_url":"https://api.github.com/users/nicoddemus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicoddemus/subscriptions","organizations_url":"https://api.github.com/users/nicoddemus/orgs","repos_url":"https://api.github.com/users/nicoddemus/repos","events_url":"https://api.github.com/users/nicoddemus/events{/privacy}","received_events_url":"https://api.github.com/users/nicoddemus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-08T16:33:42Z","updated_at":"2016-11-08T16:33:42Z","closed_at":null,"body":"Hi,\r\n\r\nWe distribute our applications in Windows and Linux using [cx-freeze](https://bitbucket.org/anthony_tuininga/cx_freeze).\r\n\r\nRecently 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](https://github.com/testing-cabal/mock/commit/e795a4a240df0039bca711999ec57f7856189547).\r\n\r\nPackaging `setuptools` inside a frozen application poses a problem though: this code from [`setuptools.sandbox`](https://github.com/pypa/setuptools/blob/master/setuptools/sandbox.py#L376) fails with an `AssertionError`:\r\n\r\n```python\r\ntry:\r\n    from win32com.client.gencache import GetGeneratePath\r\n    _EXCEPTIONS.append(GetGeneratePath())\r\n    del GetGeneratePath\r\nexcept ImportError:\r\n    # it appears pywin32 is not installed, so no need to exclude.\r\n    pass\r\n```\r\n\r\nThe 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):\r\n\r\n```python\r\ndef GetGeneratePath():\r\n    \"\"\"...\"\"\"\r\n    assert not is_readonly, \"Why do you want the genpath for a readonly store?\"\r\n```\r\n\r\nAs 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.\r\n\r\nAny thoughts or advice on this issue would be really appreciated."}}
{"actor":{"display_login":"nicoddemus"}}