20
20
21
21
from attributedict .collections import AttributeDict
22
22
23
- from six import string_types
23
+ from six import PY2 , string_types
24
24
25
25
from config2 .serializers import json_ as json
26
26
from config2 .serializers import yaml_ as yaml
@@ -117,6 +117,11 @@ def __init__(self,
117
117
this_file_path = os .path .abspath (__file__ )
118
118
119
119
for frame in inspect .stack ():
120
+ frame_filename = None
121
+
122
+ if PY2 :
123
+ frame = inspect .getframeinfo (frame [0 ])
124
+
120
125
caller_file_path = os .path .abspath (frame .filename )
121
126
122
127
is_not_this_file = (frame .filename != this_file_path )
@@ -128,7 +133,7 @@ def __init__(self,
128
133
129
134
break
130
135
131
- except :
136
+ except Exception as error :
132
137
path = os .getcwd ()
133
138
134
139
path = os .path .abspath (path )
@@ -159,7 +164,7 @@ def __init__(self,
159
164
else :
160
165
logger = logger or self .__class__ .logger ('base' )
161
166
162
- self .__config_data__ = None
167
+ self .__config_data__ = {}
163
168
self .__config_directory_name__ = config_directory_name
164
169
self .__config_files__ = []
165
170
self .__config_path__ = config_path
@@ -269,7 +274,7 @@ def reload(self):
269
274
raise error
270
275
271
276
config_datas = map ((lambda _config_file :
272
- _config_file and _config_file .data and _config_file .data .copy ()
277
+ _config_file and _config_file .data and _config_file .data .copy () or {}
273
278
), config_files )
274
279
config_datas = list (config_datas )
275
280
0 commit comments