Help, *.CHM, etc

Josiah Carlson jcarlson at uci.edu
Wed Jan 21 05:45:21 CET 2004


> > Technically os.system("c:\\path\\help.chm") and
> > os.system("start c:\\path\\help.chm") also work, though
> > are less intuitive.
> 
> No, os.system is the wrong way to do it. That function launches a new
> command shell, which in turn runs the program you want. Because of that, if
> you're not already running in a console window, it will open a new console
> window.
> 
> You had it right with os.startfile. That calls the ShellExecute function in
> Windows, which is the way you would do it in a native Windows application
> written in C.

Mike,

When the command completes, the window dissappears.  This is the case
when running from a script within pythonw or even inside of a py2exe
frozen module.  While it may not be the 100% correct way of doing things
(and you have to properly escape spaces in the file name, which then
results in having to give a window title, etc.), it does result in a
final outcome that is the same - the help file is open, your program
continues execution.

Certainly he will be using os.startfile(), but knowing that you can use
windows shell commands with os.system can be useful.

 - Josiah




More information about the Python-list mailing list