Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 11:55:26 -0500, Wildman wrote: > On Mon, 31 Oct 2016 11:05:23 -0400, Random832 wrote: > >> On Mon, Oct 31, 2016, at 10:55, Wildman via Python-list wrote: >>> I have code using that approach but I am trying to save myself >>> from having to parse the entire shadow file. Grep w

Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 11:05:23 -0400, Random832 wrote: > On Mon, Oct 31, 2016, at 10:55, Wildman via Python-list wrote: >> I have code using that approach but I am trying to save myself >> from having to parse the entire shadow file. Grep will do it >> for me if I can get code right. > > Python al

Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 08:13:54 +, Jon Ribbens wrote: > On 2016-10-31, Wildman wrote: >> Here is a bash command that I want to run from a python >> program: sudo grep "^user\:" /etc/shadow >> >> If I enter the command directly into a terminal it works >> perfectly. If I run it from a python pr

Re: Calling Bash Command From Python

2016-10-31 Thread Random832
On Mon, Oct 31, 2016, at 10:55, Wildman via Python-list wrote: > I have code using that approach but I am trying to save myself > from having to parse the entire shadow file. Grep will do it > for me if I can get code right. Python already has built-in functions to parse the shadow file. https:/

Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 09:12:57 +0100, Peter Otten wrote: > Wildman via Python-list wrote: > >> Python 2.7.9 on Linux >> >> Here is a bash command that I want to run from a python >> program: sudo grep "^user\:" /etc/shadow >> >> If I enter the command directly into a terminal it works >> perfect

Re: Calling Bash Command From Python

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 15:31:27 +1100, Chris Angelico wrote: > On Mon, Oct 31, 2016 at 3:19 PM, Wildman via Python-list > wrote: >> Here is a bash command that I want to run from a python >> program: sudo grep "^user\:" /etc/shadow >> >> If I enter the command directly into a terminal it works >> p

Re: Calling Bash Command From Python

2016-10-31 Thread Jon Ribbens
On 2016-10-31, Wildman wrote: > Here is a bash command that I want to run from a python > program: sudo grep "^user\:" /etc/shadow > > If I enter the command directly into a terminal it works > perfectly. If I run it from a python program it returns an > empty string. Below is the code I am usi

Re: Calling Bash Command From Python

2016-10-31 Thread Peter Otten
Wildman via Python-list wrote: > Python 2.7.9 on Linux > > Here is a bash command that I want to run from a python > program: sudo grep "^user\:" /etc/shadow > > If I enter the command directly into a terminal it works > perfectly. If I run it from a python program it returns an > empty string

Re: Calling Bash Command From Python

2016-10-30 Thread Chris Angelico
On Mon, Oct 31, 2016 at 3:19 PM, Wildman via Python-list wrote: > Here is a bash command that I want to run from a python > program: sudo grep "^user\:" /etc/shadow > > If I enter the command directly into a terminal it works > perfectly. If I run it from a python program it returns an > empty s