回答編集履歴

1

追加

2018/05/24 15:29

投稿

quickquip
quickquip

スコア11038

test CHANGED
@@ -11,3 +11,41 @@
11
11
 
12
12
 
13
13
  `.` というコマンドを `/tokenizer.perl -l en -q -`というオプションで実行しろ、という解釈になっているように見えますが。
14
+
15
+
16
+
17
+ ----
18
+
19
+
20
+
21
+ そもそも実行できないコマンドを指定しても、実行できませんね。当たり前ですが。
22
+
23
+
24
+
25
+
26
+
27
+ ----
28
+
29
+ `TypeError: a bytes-like object is required, not 'str'`のエラーはこちらですね。
30
+
31
+
32
+
33
+ [https://docs.python.jp/3.6/library/subprocess.html#subprocess.Popen](https://docs.python.jp/3.6/library/subprocess.html#subprocess.Popen)
34
+
35
+
36
+
37
+ > If encoding or errors are specified, (略) Otherwise, they are opened as binary streams.
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+ [https://docs.python.jp/3.6/library/subprocess.html#subprocess.Popen.communicate](https://docs.python.jp/3.6/library/subprocess.html#subprocess.Popen.communicate)
46
+
47
+ > If streams were opened in text mode, input must be a string. Otherwise, it must be bytes.
48
+
49
+
50
+
51
+ から、`Popen`を`encoding=`付きで作るなどしないと、`communicate`に渡すのはbytes型である必要がありますね。