Check if an app is installed on the device I'm trying to use the package name and determine the apk path of an app to check if my app is installed in the device. 

pathCmd = './adb shell pm path ' + packageName


pathData = os.popen(pathCmd,"r")


for pathInfo in pathData:

    print pathInfo 

    if not pathInfo:
        print "App not found on the device"

    else:
        print "App found on the device"


This doesn't give me the list of apps that are not installed. Any idea whats wrong with my script?
This did the trick guys. 

pathCmd = './adb shell pm path ' + packageName
result = os.popen(pathCmd).read()
if result:
    print "App found on the device"
else:
    print "App not found on the device"


This give system output as string and looks for string length to confirm the presence of an app in the device. Its usually an empty string that is received for a package name that doesn't exist in the device.