If I execute the command below then python returns an excellent result.
result_aftermatch= subp.Popen('ls -lrt', stdout=subp.PIPE,stderr=subp.PIPE,shell=True)
but in the same way I have a requirement for greping lines from a code file as shown below ...
list_of_id=[23,34,56,77,88] result_aftermatch= subp.Popen('egrep','list_of_IDs','/home/bimlesh/python/result.log', stdout=subp.PIPE,stderr=subp.PIPE,shell=True) result_lines,result_err= result_aftermatch.communicate() print result_lines
The above code gives an error as shown below ...
Traceback (most recent call last): File "test.py", line 144, in <module> result_aftermatch= subp.Popen('egrep','list_of_IDs','/home/bimlesh/python/result.log', stdout=subp.PIPE,stderr=subp.PIPE,shell=True) File "/usr/lib/python2.6/subprocess.py", line 573, in __init__ raise TypeError("bufsize must be an integer") TypeError: bufsize must be an integer
Please, help.
source share