using traitlets.config.get_config() in python config file breaks load_config_file
I put these lines at the top of a python config file:
from traitlets.config import get_config
c = get_config()
I did this so my editor would stop bugging me about c or get_config not being defined.
Unfortunately, this subtly broke load_config_file, because that sets up global with get_config and c, both of which I just accidentally destroyed.
I suggest that in the comments that are automatically generated when generate_config_file is used, a very explicit warning be placed to guard against this. Or perhaps there's some way to check if get_config or c has been mangled/modified accidentally
Makes sense. One option is to make sure that traitlets.config.get_config() returns the right Config object.
I'm curious, though. What config did you have that didn't load properly when you did this? I just did what you described in one of my config files and the config actually loaded correctly, even though it's doing it in a slightly peculiar way.
Unfortunately I didn't save the config file since it wasn't working, but it wasn't anything special. I don't think the problem is with the config file loading correctly, but that since get_config and c are overwritten, the config file settings no longer apply to the config object that is passed to the configurable classes. Does that make sense?
Does that make sense?
To some degree, though traitlets.config.get_config will return the current Application's config object. Adding to this object will affect what config is loaded, if it's being loaded by the current Application in the default way.
What application were you configuring?
My own custom application. Admittedly, this happened when I was still learning exactly how traitlets.config works. But I was puzzled for a while why the configuration was not showing up in my application even though I could tell that the config file was being loaded. It wasn't until I went through it step by step that I saw I was unintentionally overwriting get_config and c. It looks like I must have started using traitlets.config at version 4.3.1 if that provides any insight.