We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8d41478 commit 408d405Copy full SHA for 408d405
1 file changed
kubernetes/utils/create_from_yaml.py
@@ -11,8 +11,13 @@
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14
-import io
15
import re
+import sys
16
+
17
+if sys.version_info.major > 2:
18
+ from StringIO import StringIO
19
+else:
20
+ from io import StringIO
21
22
from os import path
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
70
yml_document_all = yaml.safe_load_all(yaml_file)
71
# Load all documents from a single YAML file
0 commit comments