[python-win32] os.startfile mysteriously failing

Tim Golden mail at timgolden.me.uk
Tue Apr 22 04:51:26 CEST 2008


King Simon-NFHD78 wrote:
> I am developing an application that, amongst other things, exports files
> and then launches them in their associated applications using
> os.startfile. It also uses webbrowser.open, which I see uses
> os.startfile.
> 
> Everything works on my PC and on all the other PCs in the office that I
> have tested on. However, when we released our first version, a few users
> reported unhandled exceptions that seem to be coming from os.startfile.

Just remembered something mildly obscure which has caused this for us
in the past: if the application which is opening (Excel, Google Earth, 
etc.) throws up some sort of modal dialog box early in the process,
ShellExecute will throw back this error. The canonical example is an
app which forces you through some sort of first-time wizard, typically
for registration. I'm fairly sure we saw it on Acrobat reader when it
was doing some sort of "Do you want these updates?" thing as well.

In case it helps.

TJG


More information about the python-win32 mailing list