os.system

Matthias Huening matthias.huening at univie.ac.at
Fri Jul 7 11:00:28 EDT 2000


Alex Martelli :

> Not all that difficult:
>
> >>> import win32api
> >>> win32api.ShellExecute(0,"open","c:\\pippo.htm",None,"",0)

Thanks! That's exactly what I was looking for.
I had found another solution on this group:

> import win32com.client
> ie=win32com.client.Dispatch('InternetExplorer.Application.1')
> ie.Visible=1
> ie.Navigate("http://www.python.org/")

Disadvantage: this only works for one browser (in this case IE).

>
> > I'd recommend browsing "Python for Win32" if you are serious
> > about surviving under windows.
>
> Yes, and I'm not even sure that would suffice (is ShellExecute
> documented there?  I'm familiar with it, because I routinely
> program under Win32 with other languages, so that's the first
> thing I looked for when trying to do something equivalent to
> a "start" from commandline, but I'm not sure how a Win32 newbie
> would learn about it...).
>
> Hammond's book is excellent, and so are his win32* extensions,
> but there might still be lots of difficulty for programmers
> that are not familiar at all with Win32 and its API's.
>

That's exactly my problem. I am not much of a programmer, but sometimes I
need a script to get things done and that is what I use Python for. I think
Python is a good all purpose language for the CP4E-kind-of-people like me
(I tried Perl before...). But the Win API's remain mysterious for me, at
least till now.

Thanks, Matthias







More information about the Python-list mailing list