subprocess : AttributeError: 'Popen' object has no attribute 'read'

Mohan Mohta mohan.mohta at gmail.com
Thu Jan 3 15:32:48 EST 2019


On Thursday, January 3, 2019 at 1:49:31 PM UTC-6, Chris Angelico wrote:
> On Fri, Jan 4, 2019 at 6:46 AM Mohan Mohta <mohan.mohta at gmail.com> wrote:
> >
> > Hello,
> > I am trying to grep the keyword (which I got from report_file ) from report_file
> >
> > I tried multiple ways but am unable to get it to work.
> 
> How about, instead, you simply open the file and iterate through it,
> looking for the keyword? 'grep' is irrelevant, and definitely 'cat' is
> a waste of effort. Python code doesn't have to be written as a less
> terse form of bash.
> 
> ChrisA

I am no expert in python but I found grep is lot faster in than the methods of reading files from python.... point me to direction if you know of anything faster I would appreciate it.




More information about the Python-list mailing list