HBNetwork / python-decouple

Strict separation of config from code.
MIT License
2.82k stars 195 forks source link

_caller_path() may not act the way it's supposed to #126

Open davidchern opened 2 years ago

davidchern commented 2 years ago

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.

henriquebastos commented 2 years ago

Very interesting. Can you provide a PR?

kvngho commented 1 year ago

May I assign this issue?