According to my test, the method _caller_path() just return name of the executed file, but not the full path. Thus, os.path.dirname(file_name) will always return an empty string ''. Although with os.path.abspath('') we will always get the current directory correctly, the method _caller_path() seems redundant and can be removed.
Then, __init__(self, search_path=None): can be modified into __init__(self, search_path=''):. And self._load(self.search_path or self._caller_path()) will be simply self._load(self.search_path). My test on this modification works well so far.
According to my test, the method
_caller_path()
just return name of the executed file, but not the full path. Thus,os.path.dirname(file_name)
will always return an empty string''
. Although withos.path.abspath('')
we will always get the current directory correctly, the method_caller_path()
seems redundant and can be removed.Then,
__init__(self, search_path=None):
can be modified into__init__(self, search_path=''):
. Andself._load(self.search_path or self._caller_path())
will be simplyself._load(self.search_path)
. My test on this modification works well so far.