Python Forum
Checking whether program is installed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Checking whether program is installed
#1
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!
Reply
#2
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
Reply
#3
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.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020