#1037165 vit: Python TypeError: 'str' object does not support item assignment

#1037165#5
Date:
2023-06-06 18:43:34 UTC
From:
To:
Dear Maintainer,

   * What led up to the situation?

   Installed vit, ran `vit` to launch program.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

   Ran `vit` command.

   * What was the outcome of this action?

Traceback (most recent call last):
  File "/usr/bin/vit", line 33, in <module>
    sys.exit(load_entry_point('vit==2.2.0', 'console_scripts', 'vit')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vit/command_line.py", line 5, in main
    Application(options, filters)
  File "/usr/lib/python3/dist-packages/vit/application.py", line 77, in __init__
    self.refresh(False)
  File "/usr/lib/python3/dist-packages/vit/application.py", line 920, in refresh
    self.bootstrap(load_early_config)
  File "/usr/lib/python3/dist-packages/vit/application.py", line 110, in bootstrap
    self.load_contexts()
  File "/usr/lib/python3/dist-packages/vit/application.py", line 104, in load_contexts
    self.contexts = self.task_config.get_contexts()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vit/config_parser.py", line 333, in get_contexts
    subtree = self.subtree('context.')
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vit/config_parser.py", line 292, in subtree
    tree_location[part] = {} if len(parts) else value
    ~~~~~~~~~~~~~^^^^^^
TypeError: 'str' object does not support item assignment

   * What outcome did you expect instead?

	Program to launch.

#1037165#10
Date:
2023-06-08 06:22:11 UTC
From:
To:
Hi Matthew,

I can't reproduce this in a fresh system (downgrading severity accordingly). Do you have any taskwarrior or vit config files in your home? Judging from the trace above I guess it is a custom taskwarrior config. Can you try without that?

Cheers Jochen

#1037165#17
Date:
2023-06-08 19:28:21 UTC
From:
To:
Hi Jochen,

Thanks for coming back to me. On first look, I thought the issue might
have been in the vit config file but following your advice, and on
closer inspection with pdb, I seemed to have two problematic lines in my
.taskrc config:

context.home=project.h
context.work=project.w

I don't know why these seemed to get by taskwarrior - perhaps they are a
legacy format, but this is not correct according to man taskrc for
2.6.2, for creating a context.

Fixed by removing these lines.

Many thanks and apologies for the "grave" bug drama.... :-)