activitywatch icon indicating copy to clipboard operation
activitywatch copied to clipboard

aw-watcher-window error

Open theguybieber opened this issue 9 years ago • 3 comments

aw-watcher-window gets a list index out of range error while trying to get the active window. Here is the stack trace:

Guys-MacBook-Pro:activitywatch guybieber$ source ./venv/bin/activate (venv) Guys-MacBook-Pro:activitywatch guybieber$ aw-watcher-window osascript: /Users/guybieber/Documents/guy/2016Karmas/Development/source/activitywatch/venv/lib/python3.6/site-packages/aw_watcher_window-0.1-py3.6.egg/aw_watcher_window/printAppTitle.scpt: No such file or directory 2017-06-01 18:20:09,324 [ERROR]: Exception thrown while trying to get active window: list index out of range (main.py:59) Traceback (most recent call last): File "/Users/guybieber/Documents/guy/2016Karmas/Development/source/activitywatch/venv/lib/python3.6/site-packages/aw_watcher_window-0.1-py3.6.egg/aw_watcher_window/main.py", line 56, in main current_window = get_current_window() File "/Users/guybieber/Documents/guy/2016Karmas/Development/source/activitywatch/venv/lib/python3.6/site-packages/aw_watcher_window-0.1-py3.6.egg/aw_watcher_window/lib.py", line 49, in get_current_window return get_current_window_macos() File "/Users/guybieber/Documents/guy/2016Karmas/Development/source/activitywatch/venv/lib/python3.6/site-packages/aw_watcher_window-0.1-py3.6.egg/aw_watcher_window/lib.py", line 29, in get_current_window_macos title = macos.getTitle(info) File "/Users/guybieber/Documents/guy/2016Karmas/Development/source/activitywatch/venv/lib/python3.6/site-packages/aw_watcher_window-0.1-py3.6.egg/aw_watcher_window/macos.py", line 17, in getTitle return info.split('","')[1][:-1] IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/guybieber/Documents/guy/2016Karmas/Development/source/activitywatch/venv/bin/aw-watcher-window", line 11, in load_entry_point('aw-watcher-window==0.1', 'console_scripts', 'aw-watcher-window')() File "/Users/guybieber/Documents/guy/2016Karmas/Development/source/activitywatch/venv/lib/python3.6/site-packages/aw_watcher_window-0.1-py3.6.egg/aw_watcher_window/main.py", line 60, in main traceback.print_exc(e) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/traceback.py", line 159, in print_exc print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/traceback.py", line 100, in print_exception type(value), value, tb, limit=limit).format(chain=chain): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/traceback.py", line 497, in init capture_locals=capture_locals) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/traceback.py", line 332, in extract if limit >= 0: TypeError: '>=' not supported between instances of 'IndexError' and 'int'

theguybieber avatar Jun 02 '17 01:06 theguybieber

I think I know what is causing this. A fix will be out later today.

Thanks for filing this issue! :)

ErikBjare avatar Jun 02 '17 06:06 ErikBjare

Fixed now, the culprit was actually in:

osascript: /Users/guybieber/Documents/guy/2016Karmas/Development/source/activitywatch/venv/lib/python3.6/site-packages/aw_watcher_window-0.1-py3.6.egg/aw_watcher_window/printAppTitle.scpt: No such file or directory

The AppleScript we use to get window title was not included in the package. This was fixed in https://github.com/ActivityWatch/aw-watcher-window/commit/85e6fff40d300c83ffcccd512af8d15837e62afa and merged into the bundle repo at https://github.com/ActivityWatch/activitywatch/commit/30a82da913b192e6f1a2623d984714144301d5ae.

Please let us know how this works for you. And again, thanks for filing the issue! :+1:

ErikBjare avatar Jun 02 '17 07:06 ErikBjare

Awesome job turning around the fix. I will try it today.

theguybieber avatar Jun 02 '17 13:06 theguybieber