{"action":"created","issue":{"url":"https://api.github.com/repos/ActivityWatch/aw-watcher-window/issues/21","repository_url":"https://api.github.com/repos/ActivityWatch/aw-watcher-window","labels_url":"https://api.github.com/repos/ActivityWatch/aw-watcher-window/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/ActivityWatch/aw-watcher-window/issues/21/comments","events_url":"https://api.github.com/repos/ActivityWatch/aw-watcher-window/issues/21/events","html_url":"https://github.com/ActivityWatch/aw-watcher-window/issues/21","id":244517729,"number":21,"title":"UnicodeDecodeError in xlib.py ","user":{"login":"nikanar","id":11622029,"avatar_url":"https://avatars1.githubusercontent.com/u/11622029?v=4","gravatar_id":"","url":"https://api.github.com/users/nikanar","html_url":"https://github.com/nikanar","followers_url":"https://api.github.com/users/nikanar/followers","following_url":"https://api.github.com/users/nikanar/following{/other_user}","gists_url":"https://api.github.com/users/nikanar/gists{/gist_id}","starred_url":"https://api.github.com/users/nikanar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikanar/subscriptions","organizations_url":"https://api.github.com/users/nikanar/orgs","repos_url":"https://api.github.com/users/nikanar/repos","events_url":"https://api.github.com/users/nikanar/events{/privacy}","received_events_url":"https://api.github.com/users/nikanar/received_events","type":"User","site_admin":false},"labels":[{"id":427555445,"url":"https://api.github.com/repos/ActivityWatch/aw-watcher-window/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-07-20T22:45:58Z","updated_at":"2017-07-28T10:06:17Z","closed_at":null,"body":"Some internet page title caught the aw-window-watcher by surprise :\r\n\r\n```\r\n2017-07-20 16:20:19,793 [INFO ]: No longer AFK  (aw_watcher_afk.afk:99)\r\n2017-07-20 16:30:45,707 [INFO ]: Became AFK  (aw_watcher_afk.afk:105)\r\n2017-07-20 16:31:05,738 [INFO ]: No longer AFK  (aw_watcher_afk.afk:99)\r\n2017-07-20 17:51:01,673 [ERROR]: Exception thrown while trying to get active window: 'bytes' object has no attribute 'encode'  (aw_watcher_window.main:73)\r\nTraceback (most recent call last):\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_watcher_window/xlib.py\", line 62, in get_window_name\r\n    return d.value.decode('utf8')\r\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 40: invalid start byte\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_watcher_window/main.py\", line 70, in heartbeat_loop\r\n    current_window = get_current_window()\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_watcher_window/lib.py\", line 44, in get_current_window\r\n    return get_current_window_linux()\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_watcher_window/lib.py\", line 14, in get_current_window_linux\r\n    name = xlib.get_window_name(window)\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_watcher_window/xlib.py\", line 64, in get_window_name\r\n    return d.value.encode('utf8').decode('utf8')\r\nAttributeError: 'bytes' object has no attribute 'encode'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"/usr/bin/aw-watcher-window\", line 11, in <module>\r\n    load_entry_point('aw-watcher-window==0.2', 'console_scripts', 'aw-watcher-window')()\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_watcher_window/main.py\", line 45, in main\r\n    heartbeat_loop(client, bucket_id, poll_time=args.poll_time, exclude_title=args.exclude_title)\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_watcher_window/main.py\", line 74, in heartbeat_loop\r\n    traceback.print_exc(e)\r\n  File \"/usr/lib/python3.6/traceback.py\", line 159, in print_exc\r\n    print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)\r\n  File \"/usr/lib/python3.6/traceback.py\", line 100, in print_exception\r\n    type(value), value, tb, limit=limit).format(chain=chain):\r\n  File \"/usr/lib/python3.6/traceback.py\", line 486, in __init__\r\n    _seen=_seen)\r\n  File \"/usr/lib/python3.6/traceback.py\", line 497, in __init__\r\n    capture_locals=capture_locals)\r\n  File \"/usr/lib/python3.6/traceback.py\", line 332, in extract\r\n    if limit >= 0:\r\nTypeError: '>=' not supported between instances of 'AttributeError' and 'int'\r\nReading active process stderr...\r\nTraceback (most recent call last):\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_qt-0.1-py3.6.egg/aw_qt/trayicon.py\", line 110, in rebuild_modules_menu\r\n    show_module_failed_dialog(module)\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_qt-0.1-py3.6.egg/aw_qt/trayicon.py\", line 96, in show_module_failed_dialog\r\n    box.setDetailedText(module.stderr())\r\n  File \"/home/will/.local/lib/python3.6/site-packages/aw_qt-0.1-py3.6.egg/aw_qt/manager.py\", line 108, in stderr\r\n    self._log += self._process.stderr.read()\r\nAttributeError: 'NoneType' object has no attribute 'read'\r\nAborted (core dumped)\r\n```\r\n\r\nNot sure how I got it, couldn't reproduce by browsing around the same pages with possible strange characters in window title, and then some.\r\n\r\nmaybe line 63 of `xlib.py`, which currently reads `except UnicodeError:`, should be `except UnicodeError, UnicodeDecodeError:`, since it seems to be a catch-all-and-coerce type code block anyway. But I dunno."},"comment":{"url":"https://api.github.com/repos/ActivityWatch/aw-watcher-window/issues/comments/318614259","html_url":"https://github.com/ActivityWatch/aw-watcher-window/issues/21#issuecomment-318614259","issue_url":"https://api.github.com/repos/ActivityWatch/aw-watcher-window/issues/21","id":318614259,"user":{"login":"ErikBjare","id":1405370,"avatar_url":"https://avatars0.githubusercontent.com/u/1405370?v=4","gravatar_id":"","url":"https://api.github.com/users/ErikBjare","html_url":"https://github.com/ErikBjare","followers_url":"https://api.github.com/users/ErikBjare/followers","following_url":"https://api.github.com/users/ErikBjare/following{/other_user}","gists_url":"https://api.github.com/users/ErikBjare/gists{/gist_id}","starred_url":"https://api.github.com/users/ErikBjare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErikBjare/subscriptions","organizations_url":"https://api.github.com/users/ErikBjare/orgs","repos_url":"https://api.github.com/users/ErikBjare/repos","events_url":"https://api.github.com/users/ErikBjare/events{/privacy}","received_events_url":"https://api.github.com/users/ErikBjare/received_events","type":"User","site_admin":false},"created_at":"2017-07-28T10:06:17Z","updated_at":"2017-07-28T10:06:17Z","body":"Seems we need a check to avoid the `.encode('utf8')` if the d.value object is a bytes object."}}
{"actor":{"display_login":"ErikBjare"}}