From 9850b70283c47ce8f8ac1d28b1f49c89ec480813 Mon Sep 17 00:00:00 2001 From: Jeff Schroeder Date: Wed, 30 Nov 2016 13:03:25 -0600 Subject: [PATCH] Make the README example code more portable Also, the `$HOME` variable can be modified while `os.path.expanduser()` does the right thing. This works on windows as well whereas the previous code did not. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 855b24f25..e477d73da 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ import os from kubernetes import client, config # Configs can be set in Configuration class directly or using helper utility -config.load_kube_config(os.environ["HOME"] + '/.kube/config') +config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config') v1=client.CoreV1Api() print("Listing pods with their IPs:") @@ -48,7 +48,7 @@ import os from kubernetes import client, config, watch # Configs can be set in Configuration class directly or using helper utility -config.load_kube_config(os.environ["HOME"] + '/.kube/config') +config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config') v1 = client.CoreV1Api() count = 10