currently I need to install some package using apt or rpm, according the OS. I saw the lib "apt" to update or upgrade the system, but it is possible use it to install a single package?
I was trying to use too "subprocess":
subprocess.Popen('apt-get install -y filetoinstall', shell=True, stdin=None, stdout=None, stderr=None, executable="/bin/bash")
But this command shows all process in the shell, I cannot hide it.
Thank you for your help.
For this particular task, as an alternative to
subprocess
you might consider using Fabric, a python deployment tool to automate builds.Use this to redirect the output to /dev/null:
The call to .wait() will block until the apt-get is complete.
You can use
check_call
from thesubprocess
library.Dump the
stdout
to/dev/null
, oros.devnull
in this case.os.devnull
is platform independent, and will return/dev/null
on POSIX andnul
on Windows (which is not relevant since you're usingapt-get
but, still good to know :) )Thank guys ! I use part of each solution. My code:
Added: stdout and .wait
Thank you one more time from Argentina !