Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: execute bash builtins in python
Steve Holden
3/13/2010 1:08:00 PM
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 *
>>> p1 = Popen("bash -i -c alias", stdout=PIPE, shell=True)
>>> p1.stdout.read()
"alias ls='ls --color=auto'\n"
>>>
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010
http://pyco...
Holden Web LLC
http://www.hold...
UPCOMING EVENTS:
http://holdenweb.event...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: execute bash builtins in python
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password