[Pythonmac-SIG] Webbrowser module?
Steven Burr
sburr@home.com
Thu, 10 Jan 2002 23:37:59 -0700
On Thursday, January 10, 2002, at 02:57 PM, Jack Jansen wrote:
>
> Recently, "Schollnick, Benjamin" <Benjamin.Schollnick@usa.xerox.com>
> said:
>> I just sat down and attempted to use the webbrowser module
>> on my Mac... And failed...
>>
>> I've got the internet control panel configured right...
>> (Pointing to the right browser)...
>>
>> But
>>
>> webbrowser.open ("http://www.yahoo.com")
>>
>> returns a trace & english text of "cannot locate runnable browser".
>
> MacPython or MachoPython? Which version? Which OS? Could you send the
> stacktrace?
I suspect Benjamin is referring to webbrowser on MachoPython. The
InternetConfig class doesn't work for MachoPython. When I tried using
webbrowser from python running in a Terminal, it opened the url in
lynx. If I hadn't had lynx installed, I'm certain I would have gotten
the "cannot locate runnable browser" message as well.
I have actually been trying to come up with a patch to webbrowser that
would allow it to open a url in an Aqua browser while running in
MachoPython and finally found something that works. It's a very simple
patch that uses the osascript command (i.e. AppleScript from the command
line) to open the url in Internet Explorer. I patched my lib/python2.2/
copy of webbrowser, and it worked fine. The patch could be extended to
accept other browsers that are scriptable in Apple Script. A default
priority list of browsers could be established as it has for other
Unices. If you think this would be worthwhile, I'd be happy to work on
adding that functionality.
I noticed that you had an assignment to add IC support for MachoPython.
If that's not working out, perhaps you could use my patch as an
alternative.
I've submitted the patch to SourceForge. This time I used OmniWeb
instead of IE to submit, and I think that solved the file format problem
you and Guido encountered with my other patch.