0

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?

phimuemue
  • 34,669
  • 9
  • 84
  • 115
Alain
  • 157
  • 1
  • 3
  • 14
  • Your users can simply double-click on the .msi file, or run it directly from a web download. What are you trying to accomplish? – Robert Harvey Aug 07 '13 at 22:11
  • 1
    I think he's trying to start the msi application from a python script but it doesn't work because the msi is not an executable and he doesn't know how to execute it. The solution is to call `msiexec`: `msiexec /i c:\path\to\python-3.3.2.msi /quiet /qn /norestart /log c:\path\to\install.log` But I'm not sure that the Python msi installer supports the silent installation... – Viktor Kerkez Aug 08 '13 at 00:05
  • @ViktorKerkez: That is exactly what I am asking. So, please permit me to update my question with your formulation. Thanks! – Alain Aug 08 '13 at 15:52
  • I just read one of the pages suggested by Philm below. It has something that looks like this: `ProcessStartInfo(exeFile, arguments)` I wonder if Python can take the arguments that same way. – Alain Oct 20 '16 at 14:11

1 Answers1

1

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#

Philm
  • 3,448
  • 1
  • 29
  • 28