在python脚本中读取行错误时的EOF

时间:2016-07-06 14:35:32

标签: python eof

我在本网站上看到此错误消息,但我无法通过这些主题解决我的问题。当我运行python脚本时,我得到以下回溯:

File "raxml_bootstrapped_genetrees.py", line 147, in main
correct_jobs = raw_input(question.format(args.cores, jobs, args.threads))
EOFError: EOF when reading a line

当我转到脚本的相关部分时,第147行:

138 def main():
139    args = get_args()
140    # get the number of jobs as available_procs / threads for raxml
141    jobs = args.cores / args.threads
142    question = "The total number of cores in use is {0}. This will run \n" + \
143        "{1} concurrent jobs of {2} thread(s). Is this correct [Y/n]? "
144    if args.quiet:
145        correct_jobs = "Y"
146    else:
147        correct_jobs = raw_input(question.format(args.cores, jobs, args.threads))
148    if correct_jobs == "Y":
149        assert jobs < multiprocessing.cpu_count(), "The total number of jobs * threads is greather than the available CPUs"
150        pool = multiprocessing.Pool(jobs)
151        # read through previous best trees to get seed values for -p
152        raxml_call_regex = re.compile("\n\nRAxML was called as follows:\n\n(.*)\n\n")
153        seeds = {}
154        all_tree_directories = glob.glob(os.path.join(args.best_trees, '*'))

get_args()如下:

def get_args():
    """Get arguments from CLI"""
    parser = argparse.ArgumentParser(
            description="""Program description""")
    parser.add_argument(
            "--input",
            required=True,
            type=is_dir,
            action=FullPaths,
            help="""The input directory containing alignments in phylip format"""
        )
    parser.add_argument(
            "--best-trees",
            required=True,
            type=is_dir,
            action=FullPaths,
            help="""The directory containing the best trees"""
        )
    parser.add_argument(
            "--output",
            required=True,
            action=CreateDir,
            help="""The output directory to hold alignments"""
        )
    parser.add_argument(
            "--bootreps",
            type=int,
            default=100,
            help="""The number of bootstrap replicates to run"""
        )
    parser.add_argument(
            "--outgroup",
            type=str,
            help="""The outgroup to use"""
        )
    parser.add_argument(
            "--threads",
            type=int,
            default=1,
            help="""The number of RAxML threads to run (best to determine empirically)"""
        )
    parser.add_argument(
            "--cores",
            type=int,
            default=1,
            help="""The number of concurrent RAxML jobs to run"""
        )
    parser.add_argument(
            "--quiet",
            action="store_true",
            default=False,
            help="""Suppress the CPU usage question""",
        )
    return parser.parse_args()

我尝试将raw_input更改为input,但会复制错误消息。我试过从jobs = args.core / args.threads发表评论。老实说,我不知道该做什么或问题是什么。默认情况下,如果未在命令中指定,则--cores--threads参数将设置为1.

0 个答案:

没有答案