python subprocess popen 无法打开_为什么Python命令不能“子流程.Popen“找到要运行的jar文件?...

Exception in thread "main" edu.stanford.nlp.io.RuntimeIOException: java.io.IOException: Input/output error

at edu.stanford.nlp.process.PTBTokenizer.getNext(PTBTokenizer.java:278)

at edu.stanford.nlp.process.PTBTokenizer.getNext(PTBTokenizer.java:163)

at edu.stanford.nlp.process.AbstractTokenizer.hasNext(AbstractTokenizer.java:55)

at edu.stanford.nlp.process.PTBTokenizer.tokReader(PTBTokenizer.java:444)

at edu.stanford.nlp.process.PTBTokenizer.tok(PTBTokenizer.java:416)

at edu.stanford.nlp.process.PTBTokenizer.main(PTBTokenizer.java:760)

Caused by: java.io.IOException: Input/output error

at java.base/java.io.FileInputStream.readBytes(Native Method)

at java.base/java.io.FileInputStream.read(FileInputStream.java:279)

at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:290)

at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)

at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)

at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)

at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)

at java.base/java.io.InputStreamReader.read(InputStreamReader.java:185)

at java.base/java.io.BufferedReader.read1(BufferedReader.java:210)

at java.base/java.io.BufferedReader.read(BufferedReader.java:287)

at edu.stanford.nlp.process.PTBLexer.zzRefill(PTBLexer.java:24511)

at edu.stanford.nlp.process.PTBLexer.next(PTBLexer.java:24718)

at edu.stanford.nlp.process.PTBTokenizer.getNext(PTBTokenizer.java:276)

... 5 more

再说一遍,我不知道为什么或是什么,但我只想和大家分享这样做可以修复它:cmd = ['/abs/path/to/java -cp /abs/path/to/stanford-corenlp-3.4.1.jar edu.stanford.nlp.process.PTBTokenizer -preserveLines -lowerCase /abs/path/to/temporary_file']

并将cmd.append(os.path.join(path_to_jar_dirname, os.path.basename(tmp_file.name)))改为{}。在

因此,将cmd放入一个只有1个元素的列表中,同时包含具有绝对路径的整个命令。谢谢你的帮助!在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值