webbrowser.open question force Firefox

kyosohma at gmail.com kyosohma at gmail.com
Mon Aug 6 09:56:42 EDT 2007


On Aug 6, 5:42 am, Thomas Jollans <tho... at jollans.com> wrote:
> On Monday 06 August 2007, dimitri pater wrote:
>
> > Hi,
> > I have a question regarding the use of webbrowser.open.
> > On a windows XP machine, MS-IE is set as the default browser so when I do:
> > webbrowser.open('http://localhost:8080') IE starts with this address.
> > But in stead of launching IE, I want to launch Firefox *without* setting
> > Firefox as the default browser globally on this machine.
>
> > Any hints, ideas? Your help is most appreciated.
>
> take an educated guess where to find firefox, check if it's there, and do
> something like
>   os.spawnl(os.P_NOWAIT, where_firefox_is, "http://localhost:8080")
>
> --
>       Regards,                       Thomas Jollans
> GPG key: 0xF421434B may be found on various keyservers, eg pgp.mit.edu
> Hacker key <http://hackerkey.com/>:
> v4sw6+8Yhw4/5ln3pr5Ock2ma2u7Lw2Nl7Di2e2t3/4TMb6HOPTen5/6g5OPa1XsMr9p-7/-6
>
>  signature.asc
> 1KDownload

Shouldn't you be using the subprocess module instead as it is
replacing the os.spawn* functionality from 2.4 on? See
http://docs.python.org/dev/lib/module-subprocess.html

If so, then the code would be:

subprocess.Popen(r'where_firefox_is http://localhost:8080')

Mike




More information about the Python-list mailing list