Re: execute bash builtins in python

2010-03-22 Thread alex goretoy
actually using the -i param in the command to subprocess doesn't seem to work as well as setting PS1 to some garbage, it starts a new interactive shell therein kicking me out of python. :/ Thank you, -Alex Goretoy -- http://mail.python.org/mailman/listinfo/python-list

Re: execute bash builtins in python

2010-03-22 Thread alex goretoy
for the broken pipe error, perhaps theres a different way I can get shell output other than using subprocess? I need the output of alias command into a string and output of declare command into a string as well, I would like to also avoid creating of a single liner script to make this happen if at

Re: execute bash builtins in python

2010-03-22 Thread alex goretoy
I do have a problem however that I don't know how to solve. My application dies abruptly at random times because of this and I get this output error in the terminal: bash: line 0: declare: write error: Broken pipe and sometimes it crashes and I get this output error; this one maybe gtk related, y

Re: execute bash builtins in python

2010-03-21 Thread alex goretoy
Thank you for the great suggestions. Steve Holden that is a good one, I will try to adapt my application to your suggestion. This way I don't have to source .bashrc when it could do all that for me including other things that it does in the background. Thank you so much. Nobody, I was not aware of

Re: execute bash builtins in python

2010-03-17 Thread Chris Colbert
On Wed, Mar 17, 2010 at 11:44 AM, Nobody wrote: > On Fri, 12 Mar 2010 08:15:49 -0500, Steve Holden wrote: > > > For shell=True I believe you should provide the command as a single > > string, not a list of arguments. > > Using shell=True with an argument list is valid. > > On Unix, it's seldom wh

Re: execute bash builtins in python

2010-03-17 Thread Nobody
On Fri, 12 Mar 2010 08:15:49 -0500, Steve Holden wrote: > For shell=True I believe you should provide the command as a single > string, not a list of arguments. Using shell=True with an argument list is valid. On Unix, it's seldom what you want: it will invoke /bin/sh to execute the first argume

Re: execute bash builtins in python

2010-03-13 Thread Steve Holden
alex goretoy wrote: > I found this to be even better; maybe someone will find this useful, who > knows. > just export PS1, duh > Popen(["bash -c 'export PS1='python'; source > $HOME/.bashrc;alias'"],shell=True,stdout=PIPE).stdout.read() > Try using an interactive shell: >>> from subprocess import

Re: execute bash builtins in python

2010-03-13 Thread alex goretoy
I found this to be even better; maybe someone will find this useful, who knows. just export PS1, duh Popen(["bash -c 'export PS1='python'; source $HOME/.bashrc;alias'"],shell=True,stdout=PIPE).stdout.read() -Alex Goretoy -- http://mail.python.org/mailman/listinfo/python-list

Re: execute bash builtins in python

2010-03-12 Thread alex goretoy
Steve thank you. The problem is that you can only run commands from Popen or os.system and stuff. You cant run bash shell builtin commands for some reason. I was able to get this to work. What I did is call this: Popen(["bash -c 'source $HOME/.bashrc;alias'"],shell=True,stdout=PIPE).stdout.read()

Re: execute bash builtins in python

2010-03-12 Thread Steve Holden
alex goretoy wrote: > hi, > i'm trying to write a section of my program that needs to run bash > builtin alias and declare, i've googled and tried every type of example > i could find no to avail. this is what I've tried below and it doesn't > work, is there a way for me to execute a bah builin fro

execute bash builtins in python

2010-03-11 Thread alex goretoy
hi, i'm trying to write a section of my program that needs to run bash builtin alias and declare, i've googled and tried every type of example i could find no to avail. this is what I've tried below and it doesn't work, is there a way for me to execute a bah builin from python? what i need is to ta