Posted on

The default file path for python is the path of ‘__main__‘, regardless of where the called module is located. To know where the module is, following is a possible way.

filename = inspect.getframeinfo(inspect.currentframe()).filename
path = os.path.dirname(os.path.abspath(filename))

default_config_file = path + '/../../config/config.json'



Leave a Reply

Your email address will not be published. Required fields are marked *