错误:[Errno 32] python代码中的管道损坏

时间:2016-04-20 21:49:56

标签: python mysql python-2.7 ubuntu-12.04 broken-pipe

我正在尝试在Ubuntu 12.04中编译这个python代码。

import numpy as np
import argparse
parser = argparse.ArgumentParser(add_help=True)
parser.register('type', 'bool',
       lambda v: v.lower() in ("yes", "true", "t", "1"))
parser.add_argument("-multi", type="bool", action="store",
           default=False, help="True output a single command")
parser.add_argument("-db_host", type=str, action="store",
           default="localhost",
           help="True output a single command")
parser.add_argument("-qoi_ex", type=str, action="store",
           default="v",
           help="Example")
parser.add_argument("-qoi_factor", type=float, default="1",
           action="store", help="QoI scaling factor")
parser.add_argument("-use_rs", type=bool, default="False",
           action="store", help="Use reaction splitting method")
args = parser.parse_known_args()[0]
# Note that 0.6931 is np.log(2)
base = "run.py -mimc_TOL {TOL} -mimc_max_TOL 0.5  \
       -qoi_seed {seed} -mimc_M0 30 -qoi_ex {ex} -qoi_factor {factor}   -use_rs True \
       -mimc_dim 1 -mimc_w 1 -mimc_s 1 -mimc_gamma 1 -mimc_beta 2    -mimc_moments 4 \
       -mimc_bayesian {bayesian} "
cmd_multi = "python " + base + "-mimc_verbose False -db True           
            -db_tag {tag} " + " -db_host {} ".format(args.db_host)
cmd_single = "python " + base + " -mimc_verbose True -db False "
tagr = lambda x: "rs" if x else "tl"
if not args.multi:
    print(cmd_single.format(seed=0, bayesian=True, TOL=0.01, ex=args.qoi_ex, factor=args.qoi_factor))
else:
    realizations = 10
    TOLs = np.sqrt(2.)**-np.arange(5., 12.)
    for TOL in TOLs:
        for i in range(0, realizations):
            print cmd_multi.format(bayesian=True, tag="TL_"+args.qoi_ex+"_"+tagr(args.use_rs), TOL=TOL,  seed=np.random.randint(2**32-1), ex=args.qoi_ex, factor=args.qoi_factor)

但我收到此错误消息,我不知道如何修复。我不确定并行化过程是否导致问题。

  

./ echo_test_cmd.py -multi True | parallel -j15 Traceback(最近一次调用last):文件“./echo_test_cmd.py”,第43行,in       print cmd_multi.format(bayesian = True,   tag =“TL _”+ args.qoi_ex +“_”+ tagr(args.use_rs),TOL = TOL,   seed = np.random.randint(2 ** 32-1),ex = args.qoi_ex,   factor = args.qoi_factor)IOError:[Errno 32]管道损坏

有人可以帮忙吗?感谢。

1 个答案:

答案 0 :(得分:0)

重新启动并重新安装并行工具包解决了这个问题。感谢