import ConfigParser
class ReadIni:
def __init__(self,file_path=None):
if file_path == None:
self.file_path == "D:/appium/Muke/config/localElement.ini"
else:
self.file_path == file_path
self.data = self.read_ini()
def read_ini(self):
read_ini = ConfigParser.ConfigParser()
read_ini.read(self.file_path)
return read_ini
def get_value(self,key):
return self.data.get('login_element',key)
if name == “main”:
read_ini = ReadIni()
print read_ini.get_value("password")
D:\appium\Muke\venv\Scripts\python.exe D:/appium/Muke/util/read_init.py
Traceback (most recent call last):
File “D:/appium/Muke/util/read_init.py”, line 22, in
read_ini = ReadIni()
File “D:/appium/Muke/util/read_init.py”, line 6, in init
self.file_path == "D:/appium/Muke/config/localElement.ini"
AttributeError: ReadIni instance has no attribute ‘file_path’