[Distutils] problem with bdist_msi post-install script

Bill Janssen janssen at parc.com
Mon Mar 22 06:51:58 CET 2010


Thanks, Tarek.

I think I see why he commented it out -- there's the issue of having
your hands on the .ico bits when you need them.  Though it does seem
that the MSI installer requires it in spite of the docs.  But the real
problem turns out to be in the add_scripts() method.

Right now, it starts out

    def add_scripts(self):
        if self.install_script:
            add_data(self.db, "CustomAction",
                    [("install_script", 50, "PYTHON", self.install_script_key)])
            add_data(self.db, "InstallExecuteSequence",
                    [("install_script", "NOT Installed", 6800)])

But if the target dir has a space in the path, this command invocation
will fail, because Python will only see the first part of the path name.

If I add double-quotes around the install script name, it works:

    def add_scripts(self):
        if self.install_script:
            # need to quote install_script_key here to pass pathnames containing
            # spaces (like "Program Files") through
            add_data(self.db, "CustomAction",
                    [("install_script", 50, "PYTHON", '"' + self.install_script_key + '"')])
            add_data(self.db, "InstallExecuteSequence",
                    [("install_script", "NOT Installed", 6800)])

And, my other question, was, how should the script exit?  Seems that
sys.exit(0) works just fine.

Bill


Tarek Ziadé <ziade.tarek at gmail.com> wrote:

> On Sun, Mar 21, 2010 at 9:45 PM, Bill Janssen <janssen at parc.com> wrote:
> > When I try to include a post-install script in my MSI built with
> > bdist_msi, it seem to be included and unpacked properly, but it doesn't
> > run successfully.  Here's what's in the script (after unpacking):
> >
> >
> > #!c:\Python26\python.exe
> >
> > # do nothing much
> > import sys, os, time
> > print "Hello, World"
> >
> > time.sleep(10)
> > sys.exit(0)
> >
> >
> > And here's what I get in my install log (generated with
> > "msiexec /i foo.msi /L*v foo.log"):
> >
> >
> > Action 18:35:46: install_script.
> > Action start 18:35:46: install_script.
> > MSI (s) (40:E0) [18:35:46:882]: Note: 1: 1722 2: install_script 3: C:\Python26\\python.exe 4: C:\Python26\Scripts\foo-install-script.py
> > MSI (s) (40:E0) [18:35:46:882]: Note: 1: 2262 2: Error 3: -2147287038
> > MSI (c) (FC:78) [18:35:46:902]: Note: 1: 2262 2: Error 3: -2147287038
> > DEBUG: Error 2835:  The control ErrorIcon was not found on dialog ErrorDlg
> > The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2835. The arguments are: ErrorIcon, ErrorDlg,
> > Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.  Action install_script, location: C:\Python26\\python.exe, command: C:\Python26\Scripts\foo-install-script.py
> > MSI (s) (40:E0) [18:35:50:978]: Note: 1: 2262 2: Error 3: -2147287038
> >
> >
> > Any ideas?  What's a postinstall script supposed to return or exit with
> > to indicate success or failure, anyway?
> >
> > What does "The control ErrorIcon was not found on dialog ErrorDlg" mean?
> 
> 
> The only reference to ErrorIcon was commented out by Martin a while
> ago. It was the icon attached to
> the Error Dialog you.  I am not sure why you get this error.
> 
> MacZiade:command tarek$ svn blame bdist_msi.py |grep ErrorIcon
>  42847 martin.v.loewis         #error.control("ErrorIcon", "Icon", 15,
> 9, 24, 24, 5242881, None, "py.ico", None, None)
> 
> 
> I am cc'ing him.
> 
> >
> > Bill
> > _______________________________________________
> > Distutils-SIG maillist  -  Distutils-SIG at python.org
> > http://mail.python.org/mailman/listinfo/distutils-sig
> >
> 
> 
> 
> -- 
> Tarek Ziadé | http://ziade.org


More information about the Distutils-SIG mailing list