alternative to hardcoding system util paths

Daniel da Silva ddasilva at
Fri Sep 17 00:23:06 UTC 2010

You could also use the subprocess module, which like os.system, doesn't care
about the absolute path of the executable.

import subprocess
p = subprocess.Popen(['aptitude', 'search', 'gnome'])

On Thu, Sep 16, 2010 at 7:07 PM, Cosme Domínguez <cosme.ddiaz at>wrote:

> 2010/9/17 Stephen Burke <steve.burke.56 at>:
> > I'm writing a python script and I'm using aptitude and update-grub in
> > the script.  Currently I just use the abolute path to the bins ie.
> > /usr/bin/aptitude.  Ultimately I'd like to package it and distribute
> > it as a deb.  What's the recommended way to get these paths so they
> > will work on any user's machine?  Are there any environment vars that
> > I should use or a service of some kind?
> >
> > Any help or pointing in the right direction would be appreciated or if
> > there is a better list to post this let me know.
> --
> Ubuntu-devel-discuss mailing list
> Ubuntu-devel-discuss at
> Modify settings or unsubscribe at:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Ubuntu-devel-discuss mailing list