{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4165","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4165/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4165/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4165/events","html_url":"https://github.com/matplotlib/matplotlib/pull/4165","id":58941981,"number":4165,"title":"Make _is_writable_dir more flexible to obscure failure modes","user":{"login":"embray","id":676149,"avatar_url":"https://avatars.githubusercontent.com/u/676149?v=3","gravatar_id":"","url":"https://api.github.com/users/embray","html_url":"https://github.com/embray","followers_url":"https://api.github.com/users/embray/followers","following_url":"https://api.github.com/users/embray/following{/other_user}","gists_url":"https://api.github.com/users/embray/gists{/gist_id}","starred_url":"https://api.github.com/users/embray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/embray/subscriptions","organizations_url":"https://api.github.com/users/embray/orgs","repos_url":"https://api.github.com/users/embray/repos","events_url":"https://api.github.com/users/embray/events{/privacy}","received_events_url":"https://api.github.com/users/embray/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/matplotlib/matplotlib/labels/needs_review","name":"needs_review","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-25T17:48:49Z","updated_at":"2015-02-25T18:15:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4165","html_url":"https://github.com/matplotlib/matplotlib/pull/4165","diff_url":"https://github.com/matplotlib/matplotlib/pull/4165.diff","patch_url":"https://github.com/matplotlib/matplotlib/pull/4165.patch"},"body":"This is pretty obscure, but is something I've observed in testing out some installation issues.\r\n\r\nWhen setuptools installs a package downloaded from a package index using `easy_install`--in particular if that package is listed in the `setup_requires` list of build-time requirements for another package, it uses a function called [`run_setup`](https://bitbucket.org/pypa/setuptools/src/e50d57c3e4ed359316dc2ddce195ecfebe0784a9/setuptools/sandbox.py?at=default#cl-224) to run the `setup.py` script for the downloaded package.  It runs the `setup.py` in the context of a [`DirectorySandbox`](https://bitbucket.org/pypa/setuptools/src/e50d57c3e4ed359316dc2ddce195ecfebe0784a9/setuptools/sandbox.py?at=default#cl-361) which prevents the `setup.py` from writing files outside of the temporary directory set up for building the package.\r\n\r\nIf, in this case, the `setup_requires` package happens to import matplotlib and it goes down the right code path that his function is called, it will result in a `SandboxViolation` because matplotlib tried to write a file outside the sandbox.  Unfortunately this is *not* an `OSError`, so the exception is raised rather than simply returning `False` is it should (indeed, the directory is not writable, so no attempt should be made to write a matplotlibrc file).\r\n\r\nI think that if matplotlib is going to attempt to write files to the filesystem during import time this function should be prepared for any kind of obscure error condition that could result :)"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/76021452","html_url":"https://github.com/matplotlib/matplotlib/pull/4165#issuecomment-76021452","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4165","id":76021452,"user":{"login":"efiring","id":85125,"avatar_url":"https://avatars.githubusercontent.com/u/85125?v=3","gravatar_id":"","url":"https://api.github.com/users/efiring","html_url":"https://github.com/efiring","followers_url":"https://api.github.com/users/efiring/followers","following_url":"https://api.github.com/users/efiring/following{/other_user}","gists_url":"https://api.github.com/users/efiring/gists{/gist_id}","starred_url":"https://api.github.com/users/efiring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/efiring/subscriptions","organizations_url":"https://api.github.com/users/efiring/orgs","repos_url":"https://api.github.com/users/efiring/repos","events_url":"https://api.github.com/users/efiring/events{/privacy}","received_events_url":"https://api.github.com/users/efiring/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T18:15:25Z","updated_at":"2015-02-25T18:15:25Z","body":"In the case where it is not an OSError, maybe it would be worth printing out the exception and then proceeding."}}