Do not attempt to load authentication config file unless it exists.
authorTom Clegg <tom@curoverse.com>
Thu, 16 Jan 2014 21:02:13 +0000 (13:02 -0800)
committerTom Clegg <tom@curoverse.com>
Thu, 16 Jan 2014 21:02:13 +0000 (13:02 -0800)
closes #1915

sdk/python/arvados/__init__.py

index 406d3ed4b21028c7dca2891dd85d5660eec93ae9..dacdba851af3a99baaa5cdda21f105cf9354d3ae 100644 (file)
@@ -27,10 +27,11 @@ import apiclient.discovery
 class ArvadosConfig(dict):
     def __init__(self, config_file):
         dict.__init__(self)
-        with open(config_file, "r") as f:
-            for config_line in f:
-                var, val = config_line.rstrip().split('=', 2)
-                self[var] = val
+        if os.path.exists(config_file):
+            with open(config_file, "r") as f:
+                for config_line in f:
+                    var, val = config_line.rstrip().split('=', 2)
+                    self[var] = val
         for var in os.environ:
             if var.startswith('ARVADOS_'):
                 self[var] = os.environ[var]