Python Forum
Checking whether program is installed - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Checking whether program is installed (/thread-3431.html)



Checking whether program is installed - Kaelmi - May-23-2017

Hey guys,

Is there an option to check with python script whether program is installed on computer or not? And give feedback in form of messagebox?

Thanks in advance!


RE: Checking whether program is installed - Larz60+ - May-23-2017

Untested but should work:

from pathlib import Path
import os

def check_file_exists(filename)       
    fullname = os.path.abspath(filename)
    if fullname.is_file():
        return True
    return False



RE: Checking whether program is installed - Ofnuts - May-23-2017

If the program was installed using the standard system installer/package manager then you can likely ask said manager (but this is of course system-dependent...). Otherwise all you can do if see if you can find the executable at some expected places (or scan the whole disk for it) but that won't always mean it is installed/usable.