{"action":"created","issue":{"url":"https://api.github.com/repos/python-pillow/Pillow/issues/1951","repository_url":"https://api.github.com/repos/python-pillow/Pillow","labels_url":"https://api.github.com/repos/python-pillow/Pillow/issues/1951/labels{/name}","comments_url":"https://api.github.com/repos/python-pillow/Pillow/issues/1951/comments","events_url":"https://api.github.com/repos/python-pillow/Pillow/issues/1951/events","html_url":"https://github.com/python-pillow/Pillow/pull/1951","id":160101295,"number":1951,"title":"Tiff: Bail out if there are no valid exif tags","user":{"login":"mgalgs","id":152014,"avatar_url":"https://avatars.githubusercontent.com/u/152014?v=3","gravatar_id":"","url":"https://api.github.com/users/mgalgs","html_url":"https://github.com/mgalgs","followers_url":"https://api.github.com/users/mgalgs/followers","following_url":"https://api.github.com/users/mgalgs/following{/other_user}","gists_url":"https://api.github.com/users/mgalgs/gists{/gist_id}","starred_url":"https://api.github.com/users/mgalgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgalgs/subscriptions","organizations_url":"https://api.github.com/users/mgalgs/orgs","repos_url":"https://api.github.com/users/mgalgs/repos","events_url":"https://api.github.com/users/mgalgs/events{/privacy}","received_events_url":"https://api.github.com/users/mgalgs/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/python-pillow/Pillow/labels/Needs%20Tests","name":"Needs Tests","color":"fbca04"},{"url":"https://api.github.com/repos/python-pillow/Pillow/labels/Tiff","name":"Tiff","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-06-14T05:38:54Z","updated_at":"2016-07-03T06:11:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/python-pillow/Pillow/pulls/1951","html_url":"https://github.com/python-pillow/Pillow/pull/1951","diff_url":"https://github.com/python-pillow/Pillow/pull/1951.diff","patch_url":"https://github.com/python-pillow/Pillow/pull/1951.patch"},"body":"Fixes #1950.\r\n\r\nChanges proposed in this pull request:\r\n\r\n * Just return if there aren't any valid-looking EXIF tags\r\n\r\nSome corrupted images end up with no valid exif tags.  This case is\r\ncurrently not handled gracefully, resulting in the following:\r\n\r\n    Traceback (most recent call last):\r\n      File \"<string>\", line 1, in <module>\r\n      File \"/Users/mitchhumpherys/Sites/str-prod/env/lib/python2.7/site-packages/PIL/JpegImagePlugin.py\", line 391, in _getexif\r\n        return _getexif(self)\r\n      File \"/Users/mitchhumpherys/Sites/str-prod/env/lib/python2.7/site-packages/PIL/JpegImagePlugin.py\", line 426, in _getexif\r\n        exif = dict(_fixup_dict(info))\r\n      File \"/Users/mitchhumpherys/Sites/str-prod/env/lib/python2.7/site-packages/PIL/JpegImagePlugin.py\", line 407, in _fixup_dict\r\n        return dict([(k, _fixup(v)) for k, v in src_dict.items()])\r\n      File \"/Users/mitchhumpherys/Sites/str-prod/env/bin/../lib/python2.7/_abcoll.py\", line 414, in items\r\n        return [(key, self[key]) for key in self]\r\n      File \"/Users/mitchhumpherys/Sites/str-prod/env/lib/python2.7/site-packages/PIL/TiffImagePlugin.py\", line 854, in __getitem__\r\n        self._setitem(tag, handler(self, data, legacy), legacy)\r\n      File \"/Users/mitchhumpherys/Sites/str-prod/env/lib/python2.7/site-packages/PIL/TiffImagePlugin.py\", line 534, in _setitem\r\n        dest[tag], = values\r\n    ValueError: need more than 0 values to unpack\r\n\r\nJust bail out if there aren't any valid tags.\r\n\r\nFixes #1950"},"comment":{"url":"https://api.github.com/repos/python-pillow/Pillow/issues/comments/230137657","html_url":"https://github.com/python-pillow/Pillow/pull/1951#issuecomment-230137657","issue_url":"https://api.github.com/repos/python-pillow/Pillow/issues/1951","id":230137657,"user":{"login":"mgalgs","id":152014,"avatar_url":"https://avatars.githubusercontent.com/u/152014?v=3","gravatar_id":"","url":"https://api.github.com/users/mgalgs","html_url":"https://github.com/mgalgs","followers_url":"https://api.github.com/users/mgalgs/followers","following_url":"https://api.github.com/users/mgalgs/following{/other_user}","gists_url":"https://api.github.com/users/mgalgs/gists{/gist_id}","starred_url":"https://api.github.com/users/mgalgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgalgs/subscriptions","organizations_url":"https://api.github.com/users/mgalgs/orgs","repos_url":"https://api.github.com/users/mgalgs/repos","events_url":"https://api.github.com/users/mgalgs/events{/privacy}","received_events_url":"https://api.github.com/users/mgalgs/received_events","type":"User","site_admin":false},"created_at":"2016-07-03T06:11:47Z","updated_at":"2016-07-03T06:11:47Z","body":"@radarhere ok, I'll add a test.\r\n\r\nOne question, the docs talk about [building from source](https://pillow.readthedocs.io/en/3.3.x/installation.html#building-from-source), but it seems to be referring to building/installing from pypi, not building from a git tree.\r\n\r\nI tried:\r\n\r\n    $ cd /path/to/Pillow-checkout\r\n    $ virtualenv2 env\r\n    $ . env/bin/activate\r\n    $ pip install .\r\n    $ nosetests -vx Tests/test_*.py\r\n    Failure: ImportError (cannot import name _imaging) ... ERROR\r\n    \r\n    ======================================================================\r\n    ERROR: Failure: ImportError (cannot import name _imaging)\r\n    ----------------------------------------------------------------------\r\n    Traceback (most recent call last):\r\n      File \"/home/mgalgs/src/Pillow/env/lib/python2.7/site-packages/nose/loader.py\", line 418, in loadTestsFromName\r\n        addr.filename, addr.module)\r\n      File \"/home/mgalgs/src/Pillow/env/lib/python2.7/site-packages/nose/importer.py\", line 47, in importFromPath\r\n        return self.importFromDir(dir_path, fqname)\r\n      File \"/home/mgalgs/src/Pillow/env/lib/python2.7/site-packages/nose/importer.py\", line 94, in importFromDir\r\n        mod = load_module(part_fqname, fh, filename, desc)\r\n      File \"/home/mgalgs/src/Pillow/Tests/test_000_sanity.py\", line 4, in <module>\r\n        import PIL.Image\r\n      File \"/home/mgalgs/src/Pillow/PIL/Image.py\", line 67, in <module>\r\n        from PIL import _imaging as core\r\n    ImportError: cannot import name _imaging\r\n    \r\n    ----------------------------------------------------------------------\r\n    Ran 1 test in 0.001s\r\n    \r\n    FAILED (errors=1)\r\n    $ python\r\n    >>> from PIL import _imaging\r\n    Traceback (most recent call last):\r\n      File \"<stdin>\", line 1, in <module>\r\n    ImportError: cannot import name _imaging\r\n\r\nWhat's the proper way of building and running Pillow from a git checkout?"}}
{"actor":{"display_login":"mgalgs"}}