Ejemplo n.º 1
0
    with open(args["input"], 'w') as f:
        json.dump(json_data, f)

    if args["output"] != "stdout":
        os.unlink(args["output"])

    sys.exit()

# Read input
with open(args["input"]) as f:
    content = f.read()

# Preprocess
if not args["skip_preprocessor"]:
    # PSI_SCRATCH must be set before this call!
    content = psi4.process_input(content)

# Handle Verbose
if args["verbose"]:
    psi4.core.print_out('\nParsed Psithon:')
    psi4.core.print_out(content)
    psi4.core.print_out('-' * 75)

# Handle Messy
_clean_functions = [psi4.core.clean, psi4.extras.clean_numpy_files]
if args["messy"]:

    if sys.version_info >= (3, 0):
        for func in _clean_functions:
            atexit.unregister(func)
    else:
Ejemplo n.º 2
0
psi4.print_header()

# Read input
with open(args["input"]) as f:
    content = f.read()

if args["scratch"] is not None:
    if not os.path.isdir(args["scratch"]):
        raise Exception("Passed in scratch is not a directory (%s)." %
                        args["scratch"])
    psi4.core.set_environment("PSI_SCRATCH", args["scratch"])

# Preprocess
if not args["skip_preprocessor"]:
    # PSI_SCRATCH must be set before this call!
    content = psi4.process_input(content)

# Handle Verbose
if args["verbose"]:
    psi4.core.print_out('\nParsed Psithon:')
    psi4.core.print_out(content)
    psi4.core.print_out('-' * 75)

# Handle Messy
if args["messy"]:
    import atexit

    for handler in atexit._exithandlers:
        if handler[0] == psi4.core.clean:
            atexit._exithandlers.remove(handler)