1 |
Benno Schulenberg a écrit : |
2 |
> Stéphane ANCELOT wrote: |
3 |
>> import webbrowser |
4 |
>> webbrowser.open('http://www.python.org') |
5 |
> |
6 |
> Works fine for me, opens the site in Firefox. |
7 |
> |
8 |
> What version of Python? |
9 |
v2.5 |
10 |
> What's in your webbrowser._browsers? |
11 |
|
12 |
this is : |
13 |
Python 2.5.1 (r251:54863, Nov 19 2007, 10:54:31) |
14 |
[GCC 4.1.2 (Gentoo 4.1.2)] on linux2 |
15 |
Type "help", "copyright", "credits" or "license" for more information. |
16 |
>>> import webbrowser |
17 |
>>> webbrowser._browsers |
18 |
{'konqueror': [<class 'webbrowser.Konqueror'>, <webbrowser.Konqueror |
19 |
object at 0xb7b061ac>], 'firefox': [None, <webbrowser.Mozilla object at |
20 |
0xb7b0612c>], 'gnome': [None, <webbrowser.BackgroundBrowser object at |
21 |
0xb7b0606c>], 'links': [None, <webbrowser.GenericBrowser object at |
22 |
0xb7b0626c>], 'opera': [None, <webbrowser.Opera object at 0xb7b0622c>], |
23 |
'seamonkey': [None, <webbrowser.Mozilla object at 0xb7b0614c>], |
24 |
'epiphany': [None, <webbrowser.Galeon object at 0xb7b0616c>], 'lynx': |
25 |
[None, <webbrowser.GenericBrowser object at 0xb7b062ec>]} |
26 |
>>> |
27 |
|
28 |
|
29 |
> Python 2.4.4 (#1, Nov 9 2007, 16:26:42) |
30 |
> |
31 |
>>>> webbrowser._browsers |
32 |
> {'kfm': [<class webbrowser.Konqueror at 0xb7bfc68c>, |
33 |
> <webbrowser.Konqueror instance at 0xb7c0054c>], 'links': [None, |
34 |
> <webbrowser.GenericBrowser instance at 0xb7c003cc>], 'lynx': [None, |
35 |
> <webbrowser.GenericBrowser instance at 0xb7c0048c>]} |
36 |
> |
37 |
> There's no Firefox in there, but it is marked as default browser |
38 |
> somewhere in KControl. |
39 |
> |
40 |
> When doing: |
41 |
|
42 |
This works : |
43 |
|
44 |
> webbrowser.register("firefox", None, webbrowser.Netscape("firefox")) |
45 |
> webbrowser._browsers['firefox'][1].open('http://www.python.org') |
46 |
> |
47 |
> it opens two Firefoxes, and opens the site in a second tab of the |
48 |
> first window. Strange. |
49 |
> |
50 |
> Benno |
51 |
|
52 |
-- |
53 |
gentoo-user@g.o mailing list |