{"action":"created","issue":{"url":"https://api.github.com/repos/jaseg/python-mpv/issues/40","repository_url":"https://api.github.com/repos/jaseg/python-mpv","labels_url":"https://api.github.com/repos/jaseg/python-mpv/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/jaseg/python-mpv/issues/40/comments","events_url":"https://api.github.com/repos/jaseg/python-mpv/issues/40/events","html_url":"https://github.com/jaseg/python-mpv/issues/40","id":244900781,"number":40,"title":"Attribute error when registering events","user":{"login":"kpj","id":645279,"avatar_url":"https://avatars0.githubusercontent.com/u/645279?v=4","gravatar_id":"","url":"https://api.github.com/users/kpj","html_url":"https://github.com/kpj","followers_url":"https://api.github.com/users/kpj/followers","following_url":"https://api.github.com/users/kpj/following{/other_user}","gists_url":"https://api.github.com/users/kpj/gists{/gist_id}","starred_url":"https://api.github.com/users/kpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kpj/subscriptions","organizations_url":"https://api.github.com/users/kpj/orgs","repos_url":"https://api.github.com/users/kpj/repos","events_url":"https://api.github.com/users/kpj/events{/privacy}","received_events_url":"https://api.github.com/users/kpj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-23T10:02:30Z","updated_at":"2017-07-23T12:47:40Z","closed_at":null,"body":"Hello,\r\n\r\nconsider the following functional code:\r\n```\r\nimport mpv\r\n\r\nplayer = mpv.MPV()\r\ndef foo(ev):\r\n    print(ev) \r\nplayer.register_event_callback(foo)\r\n```\r\nThis works as expected.\r\n\r\nIf however, I try to register not a function, but a (class-)method instead, I get an `AttributeError`:\r\n```\r\nclass Bar:                               \r\n    def baz(self, ev):\r\n        print(ev)\r\nplayer.register_event_callback(Bar().baz)\r\n```\r\n```\r\n~/.local/lib/python3.6/site-packages/mpv.py in register_event_callback(self, callback)\r\n    816         my_handler.unregister_mpv_events()\r\n    817         \"\"\"\r\n--> 818         callback.unregister_mpv_events = partial(self.unregister_event_callback, callback)\r\n    819         self._event_callbacks.append(callback)\r\n    820 \r\n\r\nAttributeError: 'method' object has no attribute 'unregister_mpv_events'\r\n```\r\n\r\nIs there a way of fixing this?"},"comment":{"url":"https://api.github.com/repos/jaseg/python-mpv/issues/comments/317250662","html_url":"https://github.com/jaseg/python-mpv/issues/40#issuecomment-317250662","issue_url":"https://api.github.com/repos/jaseg/python-mpv/issues/40","id":317250662,"user":{"login":"jaseg","id":136313,"avatar_url":"https://avatars3.githubusercontent.com/u/136313?v=4","gravatar_id":"","url":"https://api.github.com/users/jaseg","html_url":"https://github.com/jaseg","followers_url":"https://api.github.com/users/jaseg/followers","following_url":"https://api.github.com/users/jaseg/following{/other_user}","gists_url":"https://api.github.com/users/jaseg/gists{/gist_id}","starred_url":"https://api.github.com/users/jaseg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaseg/subscriptions","organizations_url":"https://api.github.com/users/jaseg/orgs","repos_url":"https://api.github.com/users/jaseg/repos","events_url":"https://api.github.com/users/jaseg/events{/privacy}","received_events_url":"https://api.github.com/users/jaseg/received_events","type":"User","site_admin":false},"created_at":"2017-07-23T12:47:40Z","updated_at":"2017-07-23T12:47:40Z","body":"I've removed that now. Try again with the current master or v0.2.7 from PyPI and it should work."}}
{"actor":{"display_login":"jaseg"}}