{"action":"closed","issue":{"url":"https://api.github.com/repos/menpo/menpo/issues/741","repository_url":"https://api.github.com/repos/menpo/menpo","labels_url":"https://api.github.com/repos/menpo/menpo/issues/741/labels{/name}","comments_url":"https://api.github.com/repos/menpo/menpo/issues/741/comments","events_url":"https://api.github.com/repos/menpo/menpo/issues/741/events","html_url":"https://github.com/menpo/menpo/issues/741","id":177787723,"number":741,"title":"menpo.io.export_landmark_file fails on ljson export","user":{"login":"mkutny","id":7115579,"avatar_url":"https://avatars.githubusercontent.com/u/7115579?v=3","gravatar_id":"","url":"https://api.github.com/users/mkutny","html_url":"https://github.com/mkutny","followers_url":"https://api.github.com/users/mkutny/followers","following_url":"https://api.github.com/users/mkutny/following{/other_user}","gists_url":"https://api.github.com/users/mkutny/gists{/gist_id}","starred_url":"https://api.github.com/users/mkutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkutny/subscriptions","organizations_url":"https://api.github.com/users/mkutny/orgs","repos_url":"https://api.github.com/users/mkutny/repos","events_url":"https://api.github.com/users/mkutny/events{/privacy}","received_events_url":"https://api.github.com/users/mkutny/received_events","type":"User","site_admin":false},"labels":[{"id":252124883,"url":"https://api.github.com/repos/menpo/menpo/labels/Beginner%20Friendly","name":"Beginner Friendly","color":"009800","default":false},{"id":37673341,"url":"https://api.github.com/repos/menpo/menpo/labels/bug","name":"bug","color":"fc2929","default":true},{"id":252126936,"url":"https://api.github.com/repos/menpo/menpo/labels/Python","name":"Python","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-19T13:42:08Z","updated_at":"2016-11-18T17:58:07Z","closed_at":"2016-11-18T17:58:07Z","body":"Apparently `_export(obj, fp)` always opens a file as 'wb' while `json.dump(obj, fp)` which is subsequently called \"always produces str objects, not bytes objects. Therefore, fp.write() must support str input\".\n\nBelow is a traceback:\n\n```\n---------------------------------------------------------------------------\nTypeError                                 Traceback (most recent call last)\n<ipython-input-19-804876baea20> in <module>()\n----> 1 menpo.io.export_landmark_file(alex.landmarks['bb'], '/Users/max/landmarks/alex.ljson', 'ljson', True)\n\n/Users/max/miniconda3/envs/menpo/lib/python3.5/site-packages/menpo/io/output/base.py in export_landmark_file(landmark_group, fp, extension, overwrite)\n     50         (the output type is not supported).\n     51     \"\"\"\n---> 52     _export(landmark_group, fp, landmark_types, extension, overwrite)\n     53 \n     54 \n\n/Users/max/miniconda3/envs/menpo/lib/python3.5/site-packages/menpo/io/output/base.py in _export(obj, fp, extensions_map, extension, overwrite, protocol)\n    363     else:\n    364         # You MUST provide an extension if a file handle is given\n--> 365         if extension is None:\n    366             raise ValueError('An export file extension must be provided if a '\n    367                              'file-like object is passed.')\n\n/Users/max/miniconda3/envs/menpo/lib/python3.5/site-packages/menpo/io/output/landmark.py in ljson_exporter(landmark_group, file_handle, **kwargs)\n     46 \n     47     return json.dump(lg_json, file_handle, indent=4, separators=(',', ': '),\n---> 48                      sort_keys=True, allow_nan=False)\n     49 \n     50 \n\n/Users/max/miniconda3/envs/menpo/lib/python3.5/json/__init__.py in dump(obj, fp, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)\n    177     # a debuggability cost\n    178     for chunk in iterable:\n--> 179         fp.write(chunk)\n    180 \n    181 \n\nTypeError: a bytes-like object is required, not 'str'\n```\n"}}
{"actor":{"display_login":"patricksnape"}}