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
Using relative config files in dicts doesn't work. It might be that I'm not using the correct syntax tho
To reproduce
3 files in the same directory
cli.py
from jsonargparse import CLI
from typing import Dict, List
class MyObject:
def __init__(self, x: int) -> None:
self.x = x
class MyCLI:
def __init__(self, d: Dict[str, MyObject]) -> None:
self.d = d
CLI(MyCLI)
(If you use a List instead of Dict for d param, same error happens)
This is not a bug. Not everything can be parsed as a subconfig. A relative path to a subconfig inside another config only works if the parser has an action that would load it. Subconfigs are only available for top-level classes in a typehint, not nested like in a dict. Generally you can see which subconfigs can be loaded by printing the --help.
If not a bug, could this be added as a new feature? Might be, though most likely it would be technically quite complex and be low priority.
This is not a bug. Not everything can be parsed as a subconfig. A relative path to a subconfig inside another config only works if the parser has an action that would load it. Subconfigs are only available for top-level classes in a typehint, not nested like in a dict. Generally you can see which subconfigs can be loaded by printing the --help.
If not a bug, could this be added as a new feature? Might be, though most likely it would be technically quite complex and be low priority.
Yeah I assumed that it was not a bug but just not supported right now. Is there a way/plan to use resolvers like omegaconf does for this kind of situation?
omegaconf resolvers are able to load subconfigs? I don't see that here, but I am not an expert on that. If it is supported, then you can make jsonargparse to use omegaconf as the yaml loader.
Using relative config files in dicts doesn't work. It might be that I'm not using the correct syntax tho
To reproduce
3 files in the same directory
cli.py
(If you use a
List
instead ofDict
ford
param, same error happens)main.yaml
my_obj.yaml
Command:
python cli.py --config main.yaml
. RaisesAs I said it might not be a bug. I'm using python 3.8, but in the project that triggered this error I'm using python 3.9.
The text was updated successfully, but these errors were encountered: