Alain
Alain

Reputation: 177

Programatically install Python msi application from a Python script

How can I programmatically install the Python msi that's on this location:

X:\install\python-3.3.2.msi

I know I can use subprocess.call() or Popen() to do that, but I don't know how to make the other parameters automatically set. Like make the program available for all users, etc.

What I am trying to do is to run the msi application from a Python script so that every time I run the script, it installs python-3.3.2.msi on the machine the script is ran for.

Now a new question is whether the Python msi installer supports silent installation. I want the installation to, in fact, be silent, i.e. I would like that the installer "knows" all parameters from the command line call and no user interaction is necessary at all. Please look at Viktor Kerkez's comment below and let me know if that's how you would do it too.

Is it possible to tell all the necessary parameters via command line?

Upvotes: 0

Views: 2495

Answers (1)

Philm
Philm

Reputation: 3674

Normally every well designed MSI can be installed silently. The given standard command line should be tried out, other optional parameters maybe TARGETDIR for the directory etc.

The msiexec parameters "/quiet" and "/qn" do the same, don't use them both.

The main problem in your case is about admin rights. A script normally does not run with admin rights, if you have not done special things (like adding/changing manual manifests). If you just use the parameter "/qb" instead of "/qn" normally MSI should come up with UAC. Try it out first, it's the easiest (maybe not the absolutely best) solution. Not silent, but unattended installation, may be sufficient for you. Or even "/qb+" then you get a final box too.

To start an installation (or everything else requiring admin rights) from a scripts needs:

1) Either a boot strapping call from an .exe (like a written setup.exe" which has got already admin rights when running

2) That you start the script with admin rights with a right mouse click or some manually added shell entry for right mouse/shell integration.

3) Change the manifest for the pyhton interpreter itself (or try compatibility flag "Always require admin rights").

If you tell us, which way to go, maybe we can give some more detailed hints. Just read me answer in the following SE question which has things in common: Install msi with msiexec and c#

Upvotes: 1

Related Questions