Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python apt manager

#!/usr/bin/env python
# aptinstall.py

import apt
import sys

pkg_name = "libjs-yui-doc"

cache = apt.cache.Cache()
cache.update()
cache.open()

pkg = cache[pkg_name]
if pkg.is_installed:
    print "{pkg_name} already installed".format(pkg_name=pkg_name)
else:
    pkg.mark_install()

    try:
        cache.commit()
    except Exception, arg:
        print >> sys.stderr, "Sorry, package installation failed [{err}]".format(err=str(arg))
Comment

PREVIOUS NEXT
Code Example
Python :: python + credit-german.csv + class 
Python :: what is a console in pythonanywhere 
Python :: oauthlib python error 
Python :: sort files in windows order python 
Python :: how to make ui dialog pop in front pyqt 
Python :: Add silence to the end of an MP3 python 
Python :: cudf - merge dataframes 
Python :: python inline print variable 
Python :: lines = paths.read().splitlines() 
Python :: fredo illos 
Python :: python-wordpress-xmlrpc get post id 
Python :: python xlrd date 
Python :: add 10 min to current time django 
Python :: How to obtain Open Weather API date/time from city being fetched? 
Python :: dont print pip jupyter 
Python :: how to vreate a list in python 
Python :: fancy index python 
Python :: django models filter(x in list) 
Python :: Delete file to trash 
Python :: python break string to sections 
Python :: Python Windows Toggle Caps_Lock 
Python :: ridge regression alpha values with cross validation score plot 
Python :: sorting list of strings by length python 
Python :: csv/gpd to shapefile python 
Python :: python SynC 
Python :: base64 encode image in python 
Python :: what will be the output of the following python code? x = 123 for i in x: print(i) 
Python :: newton backward interpolation python code 
Python :: Pandas: Ternary conditional operator for setting a value in a DataFrame 
Python :: kivy bind when text changes 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =