1

I guess what I'm looking for is closer to this question.

I'm running a python script (on a windows machine) that requires a program and a service to be installed. Since I have no control over which machines my script will be run on, I need to check from within my script, whether or not the program and service are installed on the machine.

How would I go about doing this?

EDIT: I'm not looking to check if a python module is installed. I know that I can do that very easily by just trying to import it. I'm trying to check if a program (say Mozilla Firefox) is installed on the machine

Community
  • 1
  • 1
inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241

1 Answers1

1

Original answer edited since you clarified your question.

you can use the winreg module to do a check similar to your Java post.

More specifically, you can use the OpenKey method in a try block, catching a WindowsError if the key isn't found.

Shaun
  • 3,928
  • 22
  • 21