Commit 16fa7e056cc886fb0ac4b365ba14657cdb2313fd
1 parent
35351b9e
支持方法跟新
Showing
1 changed file
with
3 additions
and
10 deletions
commons/readConf.py
@@ -20,16 +20,9 @@ class readConfig(object): | @@ -20,16 +20,9 @@ class readConfig(object): | ||
20 | self.conf = configparser.ConfigParser() | 20 | self.conf = configparser.ConfigParser() |
21 | self.evn_name = os.name | 21 | self.evn_name = os.name |
22 | self.file_name = r'test_config_hg' | 22 | self.file_name = r'test_config_hg' |
23 | - if self.evn_name == 'nt': | ||
24 | - self.relative_path = r'/config/marketConfig/' | ||
25 | - # # 本地调试路径 | ||
26 | - self.file_path = os.path.abspath(os.path.join(os.getcwd(), "../..")) + self.relative_path+self.file_name | ||
27 | - # 本地main方法执行路径 | ||
28 | -# self.file_path = os.path.abspath(os.path.join(os.getcwd(), "../")) + self.relative_path + self.file_name | ||
29 | - elif self.evn_name == 'posix': | ||
30 | - self.relative_path = r'/config/marketConfig/' | ||
31 | - self.file_path = os.path.abspath(os.path.join(os.getcwd())) + self.relative_path + self.file_name | ||
32 | - # self.file_path = os.getcwd() | 23 | + self.relative_path = r'/config/marketConfig/' |
24 | + self.file_path = os.path.abspath( | ||
25 | + os.path.join(os.path.dirname(__file__), "../")) + self.relative_path + self.file_name | ||
33 | print(self.file_path) | 26 | print(self.file_path) |
34 | self.conf.read(self.file_path,encoding="utf-8") | 27 | self.conf.read(self.file_path,encoding="utf-8") |
35 | 28 |