Open
Description
Should from npy_PyFile_Dup2 check the seekable
attribute:
numpy/numpy/core/include/numpy/npy_3kcompat.h
Line 240 in 9af9b14
For example
import subprocess as sp
a = sp.Popen(['echo hello world this is so great'], stdout=sp.PIPE, shell=True)
print(a.stdout.seekable())
print(a.stdout)
import numpy as np
np.fromfile(a.stdout, dtype='uint8', count=10)
False
<_io.BufferedReader name=13>
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-2-ab1c03142ecc> in <module>
4 print(a.stdout)
5 import numpy as np
----> 6 np.fromfile(a.stdout, dtype='uint8', count=10)
OSError: obtaining file position failed
but this works
import subprocess as sp
a = sp.Popen(['echo hello world this is so great'], stdout=sp.PIPE, bufsize=0,
shell=True)
print(a.stdout.seekable())
print(a.stdout)
import numpy as np
np.fromfile(a.stdout, dtype='uint8', count=10)
False
<_io.FileIO name=12 mode='rb' closefd=True>
array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108], dtype=uint8)
Metadata
Metadata
Assignees
Labels
No labels