[Tutor] Webbrowser (contined & new problem)

Andrei project5 at redrival.net
Wed Sep 10 00:39:58 EDT 2003


Hello again,

I've looked into it some more and found a sort of solution to my
webbrowser problem, but stumbled upon a different issue.

>> According to the code above, it should have been able to find KDE's
>> Konqueror browser fine, as long as:
>>
>>     1.  os.environ.get('DISPLAY') is some kind of true value, and

This returns under Linux ":0.0" (KDE or Gnome, doesn't matter), so it's
not the problem.

>>     2.  kfm or konqueror can be found by the system.

Tracking it down, it appears that the "BROWSER" key of the os.environ
dictionary is used. Under Gnome, this is defined as '/usr/bin/galeon'.
Under KDE, it's 'kfmclient openProfile webbrowsing'. I have no idea what
that's supposed to mean - whatever it does, it doesn't start the
browser. However, if we change this to "konqueror" before importing the
webbrowser module, it works:

===
import os

if os.environ["BROWSER"] == 'kfmclient openProfile webbrowsing':
     os.environ["BROWSER"] = "konqueror"

import webbrowser

webbrowser.open("http://google.com")
===

So far so good. It seems kinda stupid, but it works.

However, now I've noticed a different problem: when the browser is
started, my (wxPy) application waits for it to close down when running
in Linux. It will not react to anything and it will report messages
provided from the browser in the console (e.g. making a new Tab in
Galeon will produce some text which appears in the console where my app
was started).
Under Windows, the webbrowser behaves as it should: it starts and my app
doesn't care about it any more.

Any ideas why the behaviour is different under the two OSes?

Andrei



=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V
ernq gur yvfg, fb gurer'f ab arrq gb PP.





More information about the Tutor mailing list