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

Graham Dumpleton grahamd at dscpl.com.au
Mon Oct 21 02:31:09 EDT 2002


Skip Montanaro <skip at pobox.com> wrote in message news:<mailman.1035163106.24749.python-list at python.org>...
> Paul> How do I invoke Internet Explorer (or other package) from Python
>     Paul> (or from a shell prompt for that matter) on Mac OS X.  
> 
> Having just learned this recently myself, I figure passing it along would be
> worthwhile... ;-) MacOSX has an open(1) command which it inherited from
> NeXT.  To open the Python home page using the default web browser, execute:
> 
>     open http://www.python.org/
> 
> If IE isn't your default browser, you can give open(1) the -a argument
> followed by the name of the executable, something like:
> 
>     open -a 'somethingorother' http://www.python.org/
> 
> Alas, I can't figure out what 'somethingorother' should be.  Based on the
> example in the open(1) man page, I would have guessed this would work:
> 
>     open -a '/Applications/Internet Explorer.app' http://www.python.org/
> 
> but it doesn't work for me (the document continues to display in Opera, my
> default browser).

If the application bundle is installed in any of the standard locations, ie.,
in /Applications of $HOME/Applications, it is enough to say:

  open -a ApplicationName someargs

ie.:

  open -a "Internet Explorer" http://www.python.org

You don't need the full path or ".app" extension.



More information about the Python-list mailing list