Skip to content

[BUG] File-Tree tree_parser error when debugging #63

@JRandy77

Description

@JRandy77

Is there an existing issue for this?

  • I have searched the existing issues

Expected Behavior

When using relative paths for file_tree specification i.e.

.\trees\bids_raw.tree

Inconsistent crashing occurs in the file_tree internal tree parsing. It sometimes works fine, currently it works fine when I run normally but in debug mode I get the following error. (I have also had the reverse where debug mode works, and normal does not)

Current Behavior

tree = FileTree.read(pars.file_tree_path)
TypeError: unsupported operand type(s) for +: 'WindowsPath' and 'str'

In this following method of code:

def search_tree(name: str) -> Union[Path, str, FileTree]:
    """
    Search for the file defining the specific tree.

    Iteratively searches through the directories in ``tree_directories`` till a file named ${name}.tree is found.
    If not found in ``tree_directories`` the filetrees in installed python packages will be searched.

    :param name: Name of the tree
    :return: string containing the filetree definition
    """
    for directory in tree_directories:
        filename = op.join(directory, name)
        if not filename.endswith(".tree"):
            filename = filename + ".tree"
        if op.exists(filename):
            return Path(filename)

    scan_plugins()

    for ext in (".tree", ""):
        if name + ext in available_subtrees:
            return available_subtrees[name + ext]

    raise ValueError("No file tree found for %s" % name)

Error message

No response

Environment

  • OS:
  • Python/Node version:

How to reproduce

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions