OSError:[Errno 2]没有这样的文件或目录

时间:2015-10-14 11:08:06

标签: python

我有以下代码试图启动下面的每个“命令”。该模块尝试打开第二个程序并兑现

#!/usr/bin/python
from sys import argv, exit
from subprocess import Popen, PIPE
from collections import defaultdict
from os import path, remove

def main():
if len(argv) != 4 or not argv[2] in ['C', 'G', 'A', 'D']:
    print("Cas-OFFinder-bulge v1.1 beta (2015-09-30)")
    print("")
    print("Copyright (c) 2015 Jeongbin Park and Sangsu Bae")
    print("")
    print("Usage: cas-offinder-bulge {input_file} {C|G|A|D} {output_file}")
    print("(C: using CPUs, G: using GPUs, A: using accelerators, D: dry-run")
    print("")
    print("Example input file (DNA bulge 2, RNA bulge 1):")
    print("/var/chromosomes/human_hg19")
    print("NNNNNNNNNNNNNNNNNNNNNRG 2 1")
    print("GGCCGACCTGTCGCTGACGCNNN 5")
    print("CGCCAGCGTCAGCGACAGGTNNN 5")
    print("ACGGCGCCAGCGTCAGCGACNNN 5")
    print("GTCGCTGACGCTGGCGCCGTNNN 5")
    print("")
    p = Popen(['cas-offinder'], stderr=PIPE, stdout=PIPE)
    flag = False
    for line in p.stdout:
        line = line.strip()
        if line == "Available device list:":
            flag = True
        if flag:
            print(line)
else:
    fnhead = path.join(path.dirname(argv[1]), path.splitext(path.basename(argv[1]))[0])
    with open(argv[1]) as f:
        chrom_path = f.readline()
        pattern, bulge_dna, bulge_rna = f.readline().strip().split()
        isreversed = False
        for i in range(int(len(pattern)/2)):
            if pattern[i] == 'N' and pattern[len(pattern)-i-1] != 'N':
                isreversed = False
                break
            elif pattern[i] != 'N' and pattern[len(pattern)-i-1] == 'N':
                isreversed = True
                break

执行代码时,抛出以下异常:

Traceback (most recent call last):
File "./cas-offinder-bulge", line 154, in <module>
main()
File "./cas-offinder-bulge", line 24, in main
p = Popen(['cas-offinder'], stderr=PIPE, stdout=PIPE)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

我想我错过了什么,谁能指出错误? - 谢谢

0 个答案:

没有答案