I keep getting a NameError in my Python 3.7 code that I don't understand. I know the problem is indentation. From what I can tell my indentation is in order. So I am unsure where this Nameerror is coming from. Any pointers to the problem are appreciated.
Exception has occurred: NameError
name '_loadconfigfile' is not defined
Method call:
from configsettings import *
settingsfile = configSettings("setting.json")
Class causing problem:
import os
from logextension import *
class configSettings():
def __init__(self, settingsfilepath=None):
_loadconfigfile(settingsfilepath)
def _loadconfigfile(self, settingsfilepath):
configsettings = None
try:
if not os.path.exists(settingsfilepath):
raise IOError
else:
configSettings = open(settingsfilepath, "r")
except IOError as err:
msg = "Error reading file" + settingsfilepath + " "+err
_errorlogging(msg)
return configSettings
def _errorlogging(self, msg):
logger = UserdefinedLogging(__name__, 'configsettings.log', True)
logger.error(msg)