File tree
10000
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
- import io
15
14
import re
15
+ import sys
16
+
17
+ if sys .version_info .major > 2 :
18
+ from StringIO import StringIO
19
+ else :
20
+ from io import StringIO
16
21
17
22
from os import path
18
23
@@ -56,7 +61,11 @@ def create_from_yaml(
56
61
"""
57
62
if path .exists (yaml_file ):
58
63
with open (path .abspath (yaml_file )) as f :
59
- yaml_file = io .StringIO (f .read ())
64
+ content = f .read ()
65
+ try :
66
+ yaml_file = StringIO (content )
67
+ except TypeError :
68
+ yaml_file = StringIO (content .decode ('utf-8' ))
60
69
61
70
yml_document_all = yaml .safe_load_all (yaml_file )
62
71
# Load all documents from a single YAML file
You can’t perform that action at this time.
0 commit comments