Changeset 383
- Timestamp:
- 10/21/10 17:10:24
- Files:
-
- spongenet/trunk/largo_mini_andi_query_config.py (added)
- spongenet/trunk/spongenet/query.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spongenet/trunk/spongenet/query.py
r382 r383 65 65 >>> _config_path = config_path() 66 66 >>> sys.stdout = save_stdout 67 >>> USAGE == temp_stdout.getvalue()[:-1] 67 >>> USAGE == "".join(temp_stdout.getvalue()[:-1]. 68 ... splitlines(True)[1:]) 68 69 True 69 70 … … 76 77 >>> _config_path = config_path() 77 78 >>> sys.stdout = save_stdout 78 >>> USAGE == temp_stdout.getvalue()[:-1] 79 >>> USAGE == "".join(temp_stdout.getvalue()[:-1]. 80 ... splitlines(True)[1:]) 79 81 True 80 82 … … 91 93 >>> _config_path = config_path() 92 94 >>> sys.stdout = save_stdout 93 >>> USAGE == temp_stdout.getvalue()[:-1] 95 >>> USAGE == "".join(temp_stdout.getvalue()[:-1]. 96 ... splitlines(True)[1:]) 94 97 True 95 98 … … 106 109 >>> _config_path = config_path() 107 110 >>> sys.stdout = save_stdout 108 >>> USAGE == temp_stdout.getvalue()[:-1] 111 >>> USAGE == "".join(temp_stdout.getvalue()[:-1]. 112 ... splitlines(True)[1:]) 109 113 True 110 114 … … 135 139 else: 136 140 raise IOError("Incorrect number of arguments supplied.") 137 except IOError: 141 except IOError as e: 142 print e 138 143 print USAGE 139 144 return path … … 176 181 config(_config_path) 177 182 >>> sys.stdout = save_stdout 178 >>> USAGE == temp_stdout.getvalue()[:-1] 183 >>> USAGE == "".join(temp_stdout.getvalue()[:-1]. 184 ... splitlines(True)[1:]) 179 185 True 180 186 >>> ncdir … … 200 206 config(_config_path) 201 207 >>> sys.stdout = save_stdout 202 >>> USAGE == temp_stdout.getvalue()[:-1] 208 >>> USAGE == "".join(temp_stdout.getvalue()[:-1]. 209 ... splitlines(True)[1:]) 203 210 True 204 211 >>> ncdir … … 368 375 369 376 namespace = {} 370 namespace["NCDIR"] = None371 namespace["CSVDIR"] = None372 namespace["NCFILE_PATTERN"] = None373 namespace["CSVFILE_PATTERN"] = None374 namespace["LOCATION"] = None375 namespace["PLATFORM"] = None376 namespace["PACKAGES"] = None377 377 try: 378 378 execfile(path, globals(), namespace) 379 except IOError: 379 except IOError as e: 380 print e 380 381 print USAGE 381 except SyntaxError: 382 except SyntaxError as e: 383 print e 382 384 print USAGE 383 return (namespace ["NCDIR"],384 namespace ["CSVDIR"],385 namespace ["NCFILE_PATTERN"],386 namespace ["CSVFILE_PATTERN"],387 namespace ["LOCATION"],388 namespace ["PLATFORM"],389 namespace ["PACKAGES"],385 return (namespace.get("NCDIR"), 386 namespace.get("CSVDIR"), 387 namespace.get("NCFILE_PATTERN"), 388 namespace.get("CSVFILE_PATTERN"), 389 namespace.get("LOCATION"), 390 namespace.get("PLATFORM"), 391 namespace.get("PACKAGES"), 390 392 ) 391 393 … … 525 527 >>> _main() 526 528 >>> sys.stdout = save_stdout 527 >>> USAGE == temp_stdout.getvalue()[:-1] 529 >>> USAGE == "".join(temp_stdout.getvalue()[:-1]. 530 ... splitlines(True)[1:]) 528 531 True 529 532 """ … … 532 535 if _config_path: 533 536 _config = config(_config_path) 534 if all(_config): 535 query(*_config) 536 else: 537 print USAGE 537 if any(_config): 538 if all(_config): 539 query(*_config) 540 else: 541 print "Config file", _config_path, "does not contain all necessary parameters." 542 print USAGE 538 543 539 544 return