ImportError:没有名为seqfmt的模块

时间:2014-03-10 13:12:47

标签: python groovy cython

我正在通过Groovy运行python脚本:

Process p = Runtime.getRuntime().exec("python /Users/afrieden/Projects/hgvs/hgvs/tests/test_gsg_variants.py");
String s = null;
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));

System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null) {
  System.out.println(s);
}

// read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
  System.out.println(s);
}

然而,它调用了一个看起来像cython库seqfmt的东西。 (seqfmt.c和seqfmt.pyx)。

我已在sys导入中添加了它:

import sys
sys.path.append("/Users/afrieden/Projects/hgvs/build/lib/")
sys.path.append("/Users/afrieden/pythonLib/pygr-0.8.2/")
sys.path.append("/Users/afrieden/pythonLib/pygr-0.8.2/pygr/seqfmt.pyx")
sys.path.append("/Users/afrieden/pythonLib/pygr-0.8.2/pygr/seqfmt.c")
import hgvs
import csv
import hgvs.utils
from pygr.seqdb import SequenceFileDB

有关如何让它运行的任何想法?谢谢!

编辑:

它可以从命令行使用python就好了。

1 个答案:

答案 0 :(得分:0)

稍微简化您的脚本,这是否有效:

def proc = [ 'bash', '-c', 'python /Users/afrieden/Projects/hgvs/hgvs/tests/test_gsg_variants.py' ].execute()

StringWriter out = new StringWriter()
StringWriter err = new StringWriter()

proc.waitForProcessOutput( out, err )

println 'Here is the standard output of the command:'
println out.toString()

println 'Here is the standard error of the command (if any):'
println err.toString()