Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39739 > unrolled thread

webbrowser.open("./documentation/help.html")-- No Go in Windows

Started byllanitedave <llanitedave@veawb.coop>
First post2013-02-24 01:17 -0800
Last post2013-02-24 22:26 -0800
Articles 6 on this page of 26 — 8 participants

Back to article view | Back to comp.lang.python


Contents

  webbrowser.open("./documentation/help.html")--  No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 01:17 -0800
    Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Chris Rebert <clp2@rebertia.com> - 2013-02-24 01:24 -0800
    Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Demian Brecht <demianbrecht@gmail.com> - 2013-02-24 01:25 -0800
    Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Chris Rebert <clp2@rebertia.com> - 2013-02-24 01:35 -0800
      Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 12:28 -0800
        Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-24 20:50 +0000
          Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 13:06 -0800
          Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 13:06 -0800
        Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Chris Rebert <clp2@rebertia.com> - 2013-02-24 12:48 -0800
          Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 13:04 -0800
          Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 13:04 -0800
        Re: webbrowser.open("./documentation/help.html")-- No Go in Windows MRAB <python@mrabarnett.plus.com> - 2013-02-24 22:15 +0000
          Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 17:03 -0800
          Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 17:03 -0800
        Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Terry Reedy <tjreedy@udel.edu> - 2013-02-25 00:36 -0500
      Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 12:28 -0800
    Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Demian Brecht <demianbrecht@gmail.com> - 2013-02-24 15:51 -0800
      Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 18:26 -0800
      Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 18:26 -0800
    Re: webbrowser.open("./documentation/help.html")--  No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 19:37 -0800
      Re: webbrowser.open("./documentation/help.html")--  No Go in Windows Matej Cepl <mcepl@redhat.com> - 2013-02-26 14:15 +0100
    Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Terry Reedy <tjreedy@udel.edu> - 2013-02-25 00:35 -0500
      Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 22:26 -0800
        Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Chris Angelico <rosuav@gmail.com> - 2013-02-25 17:37 +1100
        Re: webbrowser.open("./documentation/help.html")-- No Go in Windows Terry Reedy <tjreedy@udel.edu> - 2013-02-25 06:10 -0500
      Re: webbrowser.open("./documentation/help.html")-- No Go in Windows llanitedave <llanitedave@veawb.coop> - 2013-02-24 22:26 -0800

Page 2 of 2 — ← Prev page 1 [2]


#39956

FromMatej Cepl <mcepl@redhat.com>
Date2013-02-26 14:15 +0100
Message-ID<slrnkipdbq.sev.mcepl@wycliff.ceplovi.cz>
In reply to#39870
On 2013-02-25, 03:37 GMT, llanitedave wrote:
>         url_link = "file:///" + fullpath

Isn't this too many slashes. On Linux I get URI

file:////usr/share/doc/whatever.html

which is just too many slashes (it should be three, two for the 
protocol, one for the root directory).

Matěj

[toc] | [prev] | [next] | [standalone]


#39874 — Re: webbrowser.open("./documentation/help.html")-- No Go in Windows

FromTerry Reedy <tjreedy@udel.edu>
Date2013-02-25 00:35 -0500
SubjectRe: webbrowser.open("./documentation/help.html")-- No Go in Windows
Message-ID<mailman.2488.1361770535.2939.python-list@python.org>
In reply to#39739
On 2/24/2013 4:35 AM, Chris Rebert wrote:

> Sounds like this might be your problem:
> http://bugs.python.org/issue8936

I just closed that issue an invalid. Here is most of what I wrote.
'''
After reading the doc and the code, I am convinced that current behavior 
is close to the implied wanted behavior, and that it is not a bug.

The doc says
  webbrowser.open(url, new=0, autoraise=True)
     Display url using the default browser.

What does 'default browswer' mean? Near the top, the doc says "If the 
environment variable BROWSER exists, it is interpreted to override the 
platform default list of browsers,". So the 'default browser' is 
actually the 'default browser list'. What open() does is to try each in 
turn and stop when one says it succeeded. So the doc should say 'using 
the first default browser that claims to succeed.'

What does 'default browser list' mean? It depends on the platform *and* 
the software loaded on the particular machine when webbrowser is first 
imported in a particular instance of the interpreter. The 'platform' 
part is in the quote above, the rest is not. I will open a separate doc 
issue.

On Windows, the list starts with 'default Windows browser', which calls 
os.startfile(), which, I believe, does call the user default browser. 
Next is Internet Explorer -- if available at that time on the particular 
machine! If the user-default browser rejects the url, then IE is tried.

On my win7 machine today, I have Firefox the default and IE available. 
Firefox rejects 127.0.0.1:8080 with an 'Unable to connect' error box. IE 
'accepts' it in the sense that it displays an information starting 'The 
webpage cannot be displayed'.
'''

For *this* issue, I strongly suspect that Chrome is rejecting the 
invalid URL and telling Python so. So IE is tried next (but not first).

> The fix would seem to be ensuring that the URL you pass includes the
> scheme (in your case, "file:").

so that Chrome does not return an error code, in which case IE should 
*not* be tried as a backup.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#39877 — Re: webbrowser.open("./documentation/help.html")-- No Go in Windows

Fromllanitedave <llanitedave@veawb.coop>
Date2013-02-24 22:26 -0800
SubjectRe: webbrowser.open("./documentation/help.html")-- No Go in Windows
Message-ID<8c651361-09b5-4954-b832-a46181cf60df@googlegroups.com>
In reply to#39874
On Sunday, February 24, 2013 9:35:17 PM UTC-8, Terry Reedy wrote:
> On 2/24/2013 4:35 AM, Chris Rebert wrote:
> 
> 
> 
> > Sounds like this might be your problem:
> 
> > http://bugs.python.org/issue8936
> 
> 
> 
> I just closed that issue an invalid. Here is most of what I wrote.
> 
> '''
> 
> After reading the doc and the code, I am convinced that current behavior 
> 
> is close to the implied wanted behavior, and that it is not a bug.
> 
> 
> 
> The doc says
> 
>   webbrowser.open(url, new=0, autoraise=True)
> 
>      Display url using the default browser.
> 
> 
> 
> What does 'default browswer' mean? Near the top, the doc says "If the 
> 
> environment variable BROWSER exists, it is interpreted to override the 
> 
> platform default list of browsers,". So the 'default browser' is 
> 
> actually the 'default browser list'. What open() does is to try each in 
> 
> turn and stop when one says it succeeded. So the doc should say 'using 
> 
> the first default browser that claims to succeed.'
> 
> 
> 
> What does 'default browser list' mean? It depends on the platform *and* 
> 
> the software loaded on the particular machine when webbrowser is first 
> 
> imported in a particular instance of the interpreter. The 'platform' 
> 
> part is in the quote above, the rest is not. I will open a separate doc 
> 
> issue.
> 
> 
> 
> On Windows, the list starts with 'default Windows browser', which calls 
> 
> os.startfile(), which, I believe, does call the user default browser. 
> 
> Next is Internet Explorer -- if available at that time on the particular 
> 
> machine! If the user-default browser rejects the url, then IE is tried.
> 
> 
> 
> On my win7 machine today, I have Firefox the default and IE available. 
> 
> Firefox rejects 127.0.0.1:8080 with an 'Unable to connect' error box. IE 
> 
> 'accepts' it in the sense that it displays an information starting 'The 
> 
> webpage cannot be displayed'.
> 
> '''
> 
> 
> 
> For *this* issue, I strongly suspect that Chrome is rejecting the 
> 
> invalid URL and telling Python so. So IE is tried next (but not first).
> 
> 
> 
> > The fix would seem to be ensuring that the URL you pass includes the
> 
> > scheme (in your case, "file:").
> 
> 
> 
> so that Chrome does not return an error code, in which case IE should 
> 
> *not* be tried as a backup.
> 
> 
> 
> -- 
> 
> Terry Jan Reedy


Terry, after what I've learned today I'm tempted to agree that it's not necessarily a bug, and that maybe all that's needed is a bit more clarity in the documentation.

On the other hand, it *is* a bit frustrating that Linux recognizes an html-style relative path, while Windows insists on the entire absolute path.  Maybe we can call it a Windows bug, but a workaround would be nice to have.

However, combined with os.path.abspath(), it's not a huge issue -- once we understand the approach. 

I certainly appreciate your taking the time to make an analysis of it, and someday I hope to have the time and skills to help out in some small way.

[toc] | [prev] | [next] | [standalone]


#39880 — Re: webbrowser.open("./documentation/help.html")-- No Go in Windows

FromChris Angelico <rosuav@gmail.com>
Date2013-02-25 17:37 +1100
SubjectRe: webbrowser.open("./documentation/help.html")-- No Go in Windows
Message-ID<mailman.2493.1361774253.2939.python-list@python.org>
In reply to#39877
On Mon, Feb 25, 2013 at 5:26 PM, llanitedave <llanitedave@veawb.coop> wrote:
> On the other hand, it *is* a bit frustrating that Linux recognizes an html-style relative path, while Windows insists on the entire absolute path.  Maybe we can call it a Windows bug, but a workaround would be nice to have.

That is, unfortunately, an all-too-common platform difference. But I'd
say that you do have that workaround:

> However, combined with os.path.abspath(), it's not a huge issue -- once we understand the approach.

If that works reliably on all platforms, I'd say that that's exactly
the nice-to-have that you describe.

ChrisA

[toc] | [prev] | [next] | [standalone]


#39885 — Re: webbrowser.open("./documentation/help.html")-- No Go in Windows

FromTerry Reedy <tjreedy@udel.edu>
Date2013-02-25 06:10 -0500
SubjectRe: webbrowser.open("./documentation/help.html")-- No Go in Windows
Message-ID<mailman.2498.1361790623.2939.python-list@python.org>
In reply to#39877
On 2/25/2013 1:26 AM, llanitedave wrote:

> On the other hand, it *is* a bit frustrating that Linux recognizes an
> html-style relative path, while Windows insists on the entire
> absolute path.  Maybe we can call it a Windows bug, but a workaround
> would be nice to have.

You can file an enhancement issue, preferably with a patch and test, as 
I do not expect anyone else to write a patch.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#39879 — Re: webbrowser.open("./documentation/help.html")-- No Go in Windows

Fromllanitedave <llanitedave@veawb.coop>
Date2013-02-24 22:26 -0800
SubjectRe: webbrowser.open("./documentation/help.html")-- No Go in Windows
Message-ID<mailman.2492.1361774212.2939.python-list@python.org>
In reply to#39874
On Sunday, February 24, 2013 9:35:17 PM UTC-8, Terry Reedy wrote:
> On 2/24/2013 4:35 AM, Chris Rebert wrote:
> 
> 
> 
> > Sounds like this might be your problem:
> 
> > http://bugs.python.org/issue8936
> 
> 
> 
> I just closed that issue an invalid. Here is most of what I wrote.
> 
> '''
> 
> After reading the doc and the code, I am convinced that current behavior 
> 
> is close to the implied wanted behavior, and that it is not a bug.
> 
> 
> 
> The doc says
> 
>   webbrowser.open(url, new=0, autoraise=True)
> 
>      Display url using the default browser.
> 
> 
> 
> What does 'default browswer' mean? Near the top, the doc says "If the 
> 
> environment variable BROWSER exists, it is interpreted to override the 
> 
> platform default list of browsers,". So the 'default browser' is 
> 
> actually the 'default browser list'. What open() does is to try each in 
> 
> turn and stop when one says it succeeded. So the doc should say 'using 
> 
> the first default browser that claims to succeed.'
> 
> 
> 
> What does 'default browser list' mean? It depends on the platform *and* 
> 
> the software loaded on the particular machine when webbrowser is first 
> 
> imported in a particular instance of the interpreter. The 'platform' 
> 
> part is in the quote above, the rest is not. I will open a separate doc 
> 
> issue.
> 
> 
> 
> On Windows, the list starts with 'default Windows browser', which calls 
> 
> os.startfile(), which, I believe, does call the user default browser. 
> 
> Next is Internet Explorer -- if available at that time on the particular 
> 
> machine! If the user-default browser rejects the url, then IE is tried.
> 
> 
> 
> On my win7 machine today, I have Firefox the default and IE available. 
> 
> Firefox rejects 127.0.0.1:8080 with an 'Unable to connect' error box. IE 
> 
> 'accepts' it in the sense that it displays an information starting 'The 
> 
> webpage cannot be displayed'.
> 
> '''
> 
> 
> 
> For *this* issue, I strongly suspect that Chrome is rejecting the 
> 
> invalid URL and telling Python so. So IE is tried next (but not first).
> 
> 
> 
> > The fix would seem to be ensuring that the URL you pass includes the
> 
> > scheme (in your case, "file:").
> 
> 
> 
> so that Chrome does not return an error code, in which case IE should 
> 
> *not* be tried as a backup.
> 
> 
> 
> -- 
> 
> Terry Jan Reedy


Terry, after what I've learned today I'm tempted to agree that it's not necessarily a bug, and that maybe all that's needed is a bit more clarity in the documentation.

On the other hand, it *is* a bit frustrating that Linux recognizes an html-style relative path, while Windows insists on the entire absolute path.  Maybe we can call it a Windows bug, but a workaround would be nice to have.

However, combined with os.path.abspath(), it's not a huge issue -- once we understand the approach. 

I certainly appreciate your taking the time to make an analysis of it, and someday I hope to have the time and skills to help out in some small way.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web