You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 24, 2024. It is now read-only.
---------------------------------------------------------------------------TypeErrorTraceback (mostrecentcalllast)
InputIn [9], in<cellline: 1>()
---->1dt["a"] =0File~/Documents/Work/Code/datatree/datatree/datatree.py:704, inDataTree.__setitem__(self, key, value)
700elifisinstance(key, str):
701# TODO should possibly deal with hashables in general?702# path-like: a name of a node/variable, or path to a node/variable703path=NodePath(key)
-->704returnself._set_item(path, value, new_nodes_along_path=True)
705else:
706raiseValueError("Invalid format for key")
File~/Documents/Work/Code/datatree/datatree/treenode.py:444, inTreeNode._set_item(self, path, item, new_nodes_along_path, allow_overwrite)
442raiseKeyError(f"Already a node object at path {path}")
443else:
-->444current_node._set(name, item)
File~/Documents/Work/Code/datatree/datatree/datatree.py:684, inDataTree._set(self, key, val)
682self.update({key: val})
683else:
-->684raiseTypeError(f"Type {type(val)} cannot be assigned to a DataTree")
TypeError: Type<class'int'>cannotbeassignedtoaDataTree
The latter syntax is convenient and intuitive, so we should relax this to accept any type, and raise an error if the DataArray constructor can't parse it.
However it's not totally trivial to implement because it breaks some assumptions in the code that walks the tree.