{"action":"created","issue":{"url":"https://api.github.com/repos/spotify/luigi/issues/1647","repository_url":"https://api.github.com/repos/spotify/luigi","labels_url":"https://api.github.com/repos/spotify/luigi/issues/1647/labels{/name}","comments_url":"https://api.github.com/repos/spotify/luigi/issues/1647/comments","events_url":"https://api.github.com/repos/spotify/luigi/issues/1647/events","html_url":"https://github.com/spotify/luigi/issues/1647","id":147427297,"number":1647,"title":"Cannot write to a binary file (LocalStorage)","user":{"login":"wires","id":315734,"avatar_url":"https://avatars.githubusercontent.com/u/315734?v=3","gravatar_id":"","url":"https://api.github.com/users/wires","html_url":"https://github.com/wires","followers_url":"https://api.github.com/users/wires/followers","following_url":"https://api.github.com/users/wires/following{/other_user}","gists_url":"https://api.github.com/users/wires/gists{/gist_id}","starred_url":"https://api.github.com/users/wires/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wires/subscriptions","organizations_url":"https://api.github.com/users/wires/orgs","repos_url":"https://api.github.com/users/wires/repos","events_url":"https://api.github.com/users/wires/events{/privacy}","received_events_url":"https://api.github.com/users/wires/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-04-11T13:26:38Z","updated_at":"2016-04-11T19:55:08Z","closed_at":null,"body":"Trying to implement a `msgpack` target (maybe not right approach...)\r\n\r\n```py\r\nclass MessagepackTarget(luigi.file.LocalTarget):\r\n    def __init__(self, filename):\r\n        super(MessagepackTarget, self).__init__(path=filename)\r\n\r\n    def dump(self, d):\r\n        with self.open('wb') as f:\r\n            msgpack.pack(d, f)\r\n```\r\n\r\nThis fails wether using mode `w` or `wb`:\r\n\r\n```\r\n  File \"... python3.5/site-packages/msgpack/__init__.py\", line 38, in pack\r\n    stream.write(packer.pack(o))\r\nTypeError: write() argument must be str, not bytes\r\n```\r\n\r\nI also tried with different format `super(MessagepackTarget, self).__init__(path=filename, format=GzipFormat)` but that fails as well:\r\n\r\n```\r\n  File \"... python3.5/site-packages/luigi/file.py\", line 126, in open:\r\n    return self.format.pipe_writer(atomic_file(self.path))\r\nTypeError: pipe_writer() missing 1 required positional argument: 'output_pipe'\r\n```\r\n\r\nWhat am I doing wrong?"},"comment":{"url":"https://api.github.com/repos/spotify/luigi/issues/comments/208529612","html_url":"https://github.com/spotify/luigi/issues/1647#issuecomment-208529612","issue_url":"https://api.github.com/repos/spotify/luigi/issues/1647","id":208529612,"user":{"login":"dlstadther","id":7432199,"avatar_url":"https://avatars.githubusercontent.com/u/7432199?v=3","gravatar_id":"","url":"https://api.github.com/users/dlstadther","html_url":"https://github.com/dlstadther","followers_url":"https://api.github.com/users/dlstadther/followers","following_url":"https://api.github.com/users/dlstadther/following{/other_user}","gists_url":"https://api.github.com/users/dlstadther/gists{/gist_id}","starred_url":"https://api.github.com/users/dlstadther/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlstadther/subscriptions","organizations_url":"https://api.github.com/users/dlstadther/orgs","repos_url":"https://api.github.com/users/dlstadther/repos","events_url":"https://api.github.com/users/dlstadther/events{/privacy}","received_events_url":"https://api.github.com/users/dlstadther/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T19:55:08Z","updated_at":"2016-04-11T19:55:08Z","body":"The line you note as not working is what currently exists in Luigi and has tests which `open('w')` (thus executing that line of code).\r\n\r\nWhere is the location of this `self.format.pipe_writer(...)`?"}}