olemartinorg/i3-alternating-layout

argument of type 'NoneType' is not iterable

Closed this issue · 2 comments

Hi,

just wanted to let you know that the script crashes from time to time with the following error.

Traceback (most recent call last):
  File "/usr/local/bin/alternating_layouts.py", line 106, in <module>
    main()
  File "/usr/local/bin/alternating_layouts.py", line 99, in main
    set_layout()
  File "/usr/local/bin/alternating_layouts.py", line 38, in set_layout
    current_win = i3.filter(nodes=[], focused=True)
  File "/usr/lib/python3.8/site-packages/i3.py", line 519, in filter
    if key not in tree or tree[key] != value:
TypeError: argument of type 'NoneType' is not iterable

Despite that, great work. Thank you!

Oh wow, that's a deep one. I believe this is an issue with i3-py not handling the case where i3.msg('get_tree') returns None, which can happen if i3-msg takes to long to return.

Unfortunately, i3-py is no longer maintained, but there is a replacement in the form of i3ipc-python.

The fix here would be to rewrite this tool to use i3ipc-python instead of i3-py. This dependency could be handled if #17 was implemented.

Should no longer be a problem after merging #26. Can you test this again?