Use the readfp()
function rather than read()
since you are opening the file before reading it. See Official Documentation.
def LoadTestInformation(self):
config = ConfigParser.ConfigParser()
print(os.path.join(os.getcwd(),'App.cfg'))
with open(os.path.join(os.getcwd(),'App.cfg'),'r') as configfile:
config.readfp(configfile)
return config.items('TestInformation')
You can continue to use read()
if you skip the file opening step and instead the full path of the file to the read()
function
def LoadTestInformation(self):
config = ConfigParser.ConfigParser()
my_file = (os.path.join(os.getcwd(),'App.cfg'))
config.read(my_file)
return config.items('TestInformation')