|
| 1 | +#!/usr/bin/env python |
| 2 | + |
1 | 3 | """
|
2 | 4 | Run derived collection builder.
|
3 | 5 |
|
@@ -83,7 +85,7 @@ def command_merge(args):
|
83 | 85 | # Connect to "core" collections.
|
84 | 86 | try:
|
85 | 87 | settings = get_settings(args.config_file)
|
86 |
| - except ConfigurationError, err: |
| 88 | + except ConfigurationError as err: |
87 | 89 | _log.error("command_merge.configuration")
|
88 | 90 | raise
|
89 | 91 | core_db = QueryEngine(**settings)
|
@@ -117,7 +119,7 @@ def command_merge(args):
|
117 | 119 | t0 = time.time()
|
118 | 120 | try:
|
119 | 121 | core.merge_tasks(core_collections, sandbox_collections, id_prefix, target, wipe=args.wipe_target)
|
120 |
| - except pymongo.errors.DuplicateKeyError, err: |
| 122 | + except pymongo.errors.DuplicateKeyError as err: |
121 | 123 | _log.error("sandbox.merge.end error=merge.duplicate_key msg={}".format(err))
|
122 | 124 | tell_user("\nDuplicate key error from MongoDB.\nUse -W/--wipe to clear target collection before merge.\n")
|
123 | 125 | return -1
|
@@ -195,7 +197,7 @@ def command_build(args):
|
195 | 197 | qe = create_qe(value, args.incr)
|
196 | 198 | parsed_builder_args[key] = qe
|
197 | 199 | query_engines.append(qe)
|
198 |
| - except ValueError, err: |
| 200 | + except ValueError as err: |
199 | 201 | raise ConfigurationError("creating query engine", err)
|
200 | 202 | elif _type in simple_types:
|
201 | 203 | parsed_builder_args[key] = simple_types[_type](value)
|
@@ -272,7 +274,7 @@ def get_settings(config_file, allow_default=True):
|
272 | 274 | cfg = json.load(open(DEFAULT_CONFIG_FILE))
|
273 | 275 | else:
|
274 | 276 | raise ValueError("Default configuration '{}' not found".format(DEFAULT_CONFIG_FILE))
|
275 |
| - except Exception, err: |
| 277 | + except Exception as err: |
276 | 278 | raise ConfigurationError(config_file, err)
|
277 | 279 | normalize_userpass(cfg)
|
278 | 280 | normalize_aliases(cfg)
|
|
0 commit comments