traitlets icon indicating copy to clipboard operation
traitlets copied to clipboard

Fix Container.from_string

Open rmorshea opened this issue 4 years ago • 1 comments

Closes: #645

It looks like #645 might actually be a slightly bigger problem than it would initially seem. You can't even do "{'tag'}" and get it to work because the Container calls self.validate(None, value) and fails because, down the callstack, a HasTraits instance is expected instead of None.

Assuming we fix that though, it looks like this issue would still persist because DeferredConfigString calls Container.from_string which blindly attempts a literal_eval and fails (because tag is not a literal Python expression), resulting in a fallback value (the raw string) being used; thus the TraitError. The solution to this (from what I can tell) is for Container.from_string(s) to call Container.from_string_list([s]).

rmorshea avatar Feb 27 '21 04:02 rmorshea

@rmorshea Closed/reopened this PR to run GH Actions.

willingc avatar May 08 '21 20:05 willingc