How do I invoke IE browser from Python on Mac OS X?

Paul Jackson pj at engr.sgi.com
Mon Oct 21 15:49:25 EDT 2002


Skip wrote:
> but the OP's question asked specifically how to launch IE on MacOSX

My original question was imperfectly stated.  My Mac
happens to have IE as the default browser, and I really
meant to ask how to launch the default browser.

I've done some more playing with 'open', and it seems
that it has the following, eh hem, "logic":

 For each argument x:
   If x "looks like" a URL:
     open with default browser
   Else:
     Access x as file in file system, prepending
       "/Applications/" and appending ".app" if need be
     Open x with the specified "-a application" if given
       else with its default application.

The "-a" value is not used for URLs.

What is the exact meaning of "looks like" I don't know, except
to say that things beginning with "http://" look like, and
things with no evident URL protocol prefix don't.

Something in the way that 'open' passes the filename to the
application is not obvious to me.  Try creating an empty file
"www.google.com" in the current directory, and then invoking:

    open -a "Internet Explorer" www.google.com

Since "www.google.com" doesn't look like a URL, and since it
does indeed name a file that open can access, open will spawn
"/Applications/Internet Explorer.app" and tell it to consider
"www.google.com".  However IE will get nowhere, stuck trying to
get information about "www.google.com", as if it didn't realize
it named a potential http server.  Not sure what is going on
there.

So in anycase, looks like Skip is stuck opening URLs with Opera.
and myself with Internet Explorer.

Thanks.

-- 
-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj at sgi.com> 1.650.933.1373



More information about the Python-list mailing list