Erm, I got it to work, I think;
here's some code and IDLE's output. Btw: a terminal still does not pop up .
Code:
import apt, sys, copy # time and os have already been imported next to the start of the script
from apt.progress import InstallProgress
class TextInstallProgress(InstallProgress):
def __init__(self):
apt.progress.InstallProgress.__init__(self)
self.last = 0.0
def updateInterface(self):
InstallProgress.updateInterface(self)
if self.last >= self.percent:
return
sys.stdout.write("\r[%s] %s\n" %(self.percent, self.status))
sys.stdout.flush()
self.last = self.percent
def conffile(self,current,new):
print "conffile prompt: %s %s" % (current,new)
def error(self, errorstr):
print "got dpkg error: '%s'" % errorstr
cache = apt.Cache(apt.progress.OpTextProgress())
fprogress = apt.progress.TextFetchProgress()
iprogress = TextInstallProgress()
pkg = cache["sudo"]
pkg.markInstall() # "sudo.markInstall failed...
On the bright side, this method works! But who would do all of that when a simple os.system('cmd') works?
Any other suggestions? My script works if I can get my users to edit file permissions to make it executable, and run it in the terminal.... But no one reads the docs....
Bookmarks