Skip to content

possible issue with bob.extension.config.load mechanism

In this part of the code https://gitlab.idiap.ch/bob/bob.extension/blob/master/bob/extension/config.py#L82, the new config load mechanism cleans a lot of stuff from the module loading including information that might be useful (like imports).

For example, take config file example (lots of test cases from bob.bio.base are like that):

import numpy

class RandomPrints(object):
    def __init__(self):
       pass
       
    def __call__(self):
        return numpy.random.rand()


random_prints = RandomPrints()

When I try to execute it:

from bob.extension.config import load

config = load(["bug_config.py"])
print(config["random_prints"]())

I got the error:

AttributeError: 'NoneType' object has no attribute 'random'

The import numpy is lost in the context (on purpose).

This issue raises a philosophical question @bob and would be nice to have some feedback from you. The configs should be just simple configs or should carry some extra complexity (class definitions for instance)?

Thanks

Edited by Tiago de Freitas Pereira