質問編集履歴
2
otnさんの修正依頼への対応(コメント時刻のミスを修正)
title
CHANGED
File without changes
|
body
CHANGED
@@ -70,7 +70,7 @@
|
|
70
70
|
|
71
71
|
### 修正依頼への対応
|
72
72
|
|
73
|
-
> otn
|
73
|
+
> otn 2020/05/04 18:08
|
74
74
|
> 切り分けのために、下記でどうなりますか? subprocess.run('ls -l <NUL 2>NUL ', shell=True, capture_output=True)
|
75
75
|
|
76
76
|
次のようにプログラムを変え、実行しました。
|
1
otnさんの修正依頼への対応
title
CHANGED
File without changes
|
body
CHANGED
@@ -66,4 +66,36 @@
|
|
66
66
|
- OS: Windows 10 (1909)
|
67
67
|
- Python: 3.8.2
|
68
68
|
- Vim: 8.2.694
|
69
|
-
- vim-quickrun: [f637c35](https://github.com/thinca/vim-quickrun/tree/f637c35b16d6e83cc71dababbda2a64eb29b3f5e)
|
69
|
+
- vim-quickrun: [f637c35](https://github.com/thinca/vim-quickrun/tree/f637c35b16d6e83cc71dababbda2a64eb29b3f5e)
|
70
|
+
|
71
|
+
### 修正依頼への対応
|
72
|
+
|
73
|
+
> otn 34分前
|
74
|
+
> 切り分けのために、下記でどうなりますか? subprocess.run('ls -l <NUL 2>NUL ', shell=True, capture_output=True)
|
75
|
+
|
76
|
+
次のようにプログラムを変え、実行しました。
|
77
|
+
|
78
|
+
```python
|
79
|
+
import subprocess
|
80
|
+
|
81
|
+
# cp = subprocess.run(['ls', '-l'], capture_output=True)
|
82
|
+
cp = subprocess.run('ls -l <NUL 2>NUL ', shell=True, capture_output=True)
|
83
|
+
|
84
|
+
# stdoutの中身を使ってなにかする……
|
85
|
+
print(cp.stdout.decode('utf-8'))
|
86
|
+
```
|
87
|
+
|
88
|
+
実行結果は次の通りで、同じようなエラーが出るようでした。
|
89
|
+
|
90
|
+
```ErrorMessage
|
91
|
+
Traceback (most recent call last):
|
92
|
+
File "C:\dev\study\python\subproc.py", line 4, in <module>
|
93
|
+
cp = subprocess.run('ls -l <NUL 2>NUL ', shell=True, capture_output=True)
|
94
|
+
File "C:\Users\terai\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 489, in run
|
95
|
+
with Popen(*popenargs, **kwargs) as process:
|
96
|
+
File "C:\Users\terai\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 804, in __init__
|
97
|
+
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
|
98
|
+
File "C:\Users\terai\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1142, in _get_handles
|
99
|
+
p2cread = _winapi.GetStdHandle(_winapi.STD_INPUT_HANDLE)
|
100
|
+
OSError: [WinError 6] ハンドルが無効です。
|
101
|
+
```
|