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

Chris Angelico rosuav at gmail.com
Thu Jan 3 14:49:04 EST 2019


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



More information about the Python-list mailing list