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

2013-02-26 Thread Matej Cepl
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
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-25 Thread Terry Reedy

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

--
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread llanitedave
I created an html help page for my Python 2.7.3 application and put it in a 
documentation folder.  I used webbrowser.open() to fetch the page.

On linux -- KDE specifically, the command opens the local file on my default 
browser with no issues.  However, on Windows 7, it opens Internet Explorer, 
which doesn't even search the local folder, but goes straight to the web and 
does a Google search, returning nothing but useless noise.

My default browser on Windows is Chrome, so my intention is getting undermined 
right from the start.

How do I get a local html file to open properly from Python in Windows?
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread Chris Rebert
On Feb 24, 2013 1:21 AM, llanitedave llanited...@veawb.coop wrote:

 I created an html help page for my Python 2.7.3 application and put it in
a documentation folder.  I used webbrowser.open() to fetch the page.

 On linux -- KDE specifically, the command opens the local file on my
default browser with no issues.  However, on Windows 7, it opens Internet
Explorer, which doesn't even search the local folder, but goes straight to
the web and does a Google search, returning nothing but useless noise.

 My default browser on Windows is Chrome, so my intention is getting
undermined right from the start.

 How do I get a local html file to open properly from Python in Windows?

Please provide the exact code snippet that you're using.

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread Demian Brecht
Rather than using a relative path, try using
webbrowser.open('{}/documentation/help.html'.format(os.path.dirname(__file__))).

On Sun, Feb 24, 2013 at 1:17 AM, llanitedave llanited...@veawb.coop wrote:
 I created an html help page for my Python 2.7.3 application and put it in a 
 documentation folder.  I used webbrowser.open() to fetch the page.

 On linux -- KDE specifically, the command opens the local file on my default 
 browser with no issues.  However, on Windows 7, it opens Internet Explorer, 
 which doesn't even search the local folder, but goes straight to the web and 
 does a Google search, returning nothing but useless noise.

 My default browser on Windows is Chrome, so my intention is getting 
 undermined right from the start.

 How do I get a local html file to open properly from Python in Windows?
 --
 http://mail.python.org/mailman/listinfo/python-list



--
Demian Brecht
http://demianbrecht.github.com
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread Chris Rebert
On Feb 24, 2013 1:21 AM, llanitedave llanited...@veawb.coop wrote:

 I created an html help page for my Python 2.7.3 application and put it in
a documentation folder.  I used webbrowser.open() to fetch the page.

 On linux -- KDE specifically, the command opens the local file on my
default browser with no issues.  However, on Windows 7, it opens Internet
Explorer, which doesn't even search the local folder, but goes straight to
the web and does a Google search, returning nothing but useless noise.

 My default browser on Windows is Chrome, so my intention is getting
undermined right from the start.

 How do I get a local html file to open properly from Python in Windows?

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

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

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread llanitedave
On Sunday, February 24, 2013 1:35:31 AM UTC-8, Chris Rebert wrote:
 On Feb 24, 2013 1:21 AM, llanitedave llani...@veawb.coop wrote:
 
 
 
  I created an html help page for my Python 2.7.3 application and put it in a 
  documentation folder.  I used webbrowser.open() to fetch the page.
 
 
 
  On linux -- KDE specifically, the command opens the local file on my 
  default browser with no issues.  However, on Windows 7, it opens Internet 
  Explorer, which doesn't even search the local folder, but goes straight to 
  the web and does a Google search, returning nothing but useless noise.
 
 
 
 
  My default browser on Windows is Chrome, so my intention is getting 
  undermined right from the start.
 
 
 
  How do I get a local html file to open properly from Python in Windows?
 
 Sounds like this might be your problem:
 
 http://bugs.python.org/issue8936
 
 The fix would seem to be ensuring that the URL you pass includes the scheme 
 (in your case, file:).
 
 Cheers,
 
 Chris

Holy Toledo!  That's a two-year-old bug spanning two versions of the language!

BTW, Chris, the snippet I showed in the title essentially WAS the exact code.  
It's a method with that single line called from a wxPython Help menu.  I can't 
really put an absolute pathname into the argument, because the application is 
going to be distributed to a variety of computers at my workplace, and there's 
no assurance that it will go into (or remain in)a particular folder.

I was trying to avoid using the wx.html.HtmlWindow feature of wxPython, because 
it doesn't handle CSS and styles.  My help page is the portal to a multi-page 
users guide with a style sheet to render all the content consistently.

Plus, I couldn't get the wx.html.HtmlWindow to open relative paths either -- it 
gave me URL Malformed messages even in KDE, when webbrowser.open(filepath) 
was working for the exact same path.  But that's something to take up on the 
wxPython list, I guess.

This to me illustrates the downside of the Python philosophy of There should 
be only one obvious way to do things.  If that one obvious way has a fatal 
bug, you're pretty much SOL.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread Mark Lawrence

On 24/02/2013 20:28, llanitedave wrote:

On Sunday, February 24, 2013 1:35:31 AM UTC-8, Chris Rebert wrote:

On Feb 24, 2013 1:21 AM, llanitedave llani...@veawb.coop wrote:






I created an html help page for my Python 2.7.3 application and put it in a 
documentation folder.  I used webbrowser.open() to fetch the page.







On linux -- KDE specifically, the command opens the local file on my default 
browser with no issues.  However, on Windows 7, it opens Internet Explorer, 
which doesn't even search the local folder, but goes straight to the web and 
does a Google search, returning nothing but useless noise.








My default browser on Windows is Chrome, so my intention is getting undermined 
right from the start.







How do I get a local html file to open properly from Python in Windows?


Sounds like this might be your problem:

http://bugs.python.org/issue8936

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

Cheers,

Chris


Holy Toledo!  That's a two-year-old bug spanning two versions of the language!


Only two years is nothing.  Pay your money, take your choice :)


This to me illustrates the downside of the Python philosophy of There should be 
only one obvious way to do things.  If that one obvious way has a fatal bug, you're 
pretty much SOL.


Misquoted as always.  I guess that some day someone will quote it correctly.

--
Cheers.

Mark Lawrence

--
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread Chris Rebert
On Sun, Feb 24, 2013 at 12:28 PM, llanitedave llanited...@veawb.coop wrote:
 On Sunday, February 24, 2013 1:35:31 AM UTC-8, Chris Rebert wrote:
 On Feb 24, 2013 1:21 AM, llanitedave llani...@veawb.coop wrote:
  I created an html help page for my Python 2.7.3 application and put it in 
  a documentation folder.  I used webbrowser.open() to fetch the page.
  On linux -- KDE specifically, the command opens the local file on my 
  default browser with no issues.  However, on Windows 7, it opens Internet 
  Explorer, which doesn't even search the local folder, but goes straight to 
  the web and does a Google search, returning nothing but useless noise.
  My default browser on Windows is Chrome, so my intention is getting 
  undermined right from the start.
  How do I get a local html file to open properly from Python in Windows?

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

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

 Holy Toledo!  That's a two-year-old bug spanning two versions of the language!

 BTW, Chris, the snippet I showed in the title essentially WAS the exact code.

Sorry, my bad. This is why I dislike messages that put critical info
*only* in the subject line; I tend not to reread the subject line once
I've opened the message.

  It's a method with that single line called from a wxPython Help menu.  I 
 can't really put an absolute pathname into the argument, because the 
 application is going to be distributed to a variety of computers at my 
 workplace, and there's no assurance that it will go into (or remain in)a 
 particular folder.

As Demian demonstrated, you can simply compute the absolute path from
the relative path at runtime; although I would probably toss an
abspath() call in for good measure
(http://docs.python.org/2/library/os.path.html#os.path.abspath ).

 This to me illustrates the downside of the Python philosophy of There should 
 be only one obvious way to do things.  If that one obvious way has a fatal 
 bug, you're pretty much SOL.

On the other hand, you don't have to investigate which of N APIs is
the fixed/correct one (Which PHP MySQL function is safe from SQL
injection again?), and you only have wait for 1 fix instead of N. But
yes, some of Python's included batteries are due for some recharging.

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread llanitedave
On Sunday, February 24, 2013 12:48:40 PM UTC-8, Chris Rebert wrote:
 On Sun, Feb 24, 2013 at 12:28 PM, llanitedave llanited...@veawb.coop wrote:
 
  On Sunday, February 24, 2013 1:35:31 AM UTC-8, Chris Rebert wrote:
 
  On Feb 24, 2013 1:21 AM, llanitedave llani...@veawb.coop wrote:
 
   I created an html help page for my Python 2.7.3 application and put it 
   in a documentation folder.  I used webbrowser.open() to fetch the page.
 
   On linux -- KDE specifically, the command opens the local file on my 
   default browser with no issues.  However, on Windows 7, it opens 
   Internet Explorer, which doesn't even search the local folder, but goes 
   straight to the web and does a Google search, returning nothing but 
   useless noise.
 
   My default browser on Windows is Chrome, so my intention is getting 
   undermined right from the start.
 
   How do I get a local html file to open properly from Python in Windows?
 
 
 
  Sounds like this might be your problem:
 
  http://bugs.python.org/issue8936
 
 
 
  The fix would seem to be ensuring that the URL you pass includes the 
  scheme (in your case, file:).
 
 
 
  Holy Toledo!  That's a two-year-old bug spanning two versions of the 
  language!
 
 
 
  BTW, Chris, the snippet I showed in the title essentially WAS the exact 
  code.
 
 
 
 Sorry, my bad. This is why I dislike messages that put critical info
 
 *only* in the subject line; I tend not to reread the subject line once
 
 I've opened the message.
 

Nah, my bad.  I didn't realize that the title was the only place I'd put the 
actual command.  I don't like it when other people do that either.

 
 
   It's a method with that single line called from a wxPython Help menu.  I 
  can't really put an absolute pathname into the argument, because the 
  application is going to be distributed to a variety of computers at my 
  workplace, and there's no assurance that it will go into (or remain in)a 
  particular folder.
 
 
 
 As Demian demonstrated, you can simply compute the absolute path from
 
 the relative path at runtime; although I would probably toss an
 
 abspath() call in for good measure
 
 (http://docs.python.org/2/library/os.path.html#os.path.abspath ).
 
 

OK, I'm going to have to study that one a bit.  It looks like a new concept for 
my feeble brain.

 
  This to me illustrates the downside of the Python philosophy of There 
  should be only one obvious way to do things.  If that one obvious way has 
  a fatal bug, you're pretty much SOL.
 
 
 
 On the other hand, you don't have to investigate which of N APIs is
 
 the fixed/correct one (Which PHP MySQL function is safe from SQL
 
 injection again?), and you only have wait for 1 fix instead of N. But
 
 yes, some of Python's included batteries are due for some recharging.
 
 
 
 Cheers,
 
 Chris

You're right.  It's one thing to have a persistent bug, it's another thing to 
offer the function in the documentation as if the bug doesn't exist.

The bug report from October 2010 indicated that someone was working on a fix at 
that time.  The fact that it's still not fixed implies that it might be 
something that's really hard to pin down.  In a case like that, it's probably 
better to simply withdraw the feature, or tag it as Non-windows only
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread llanitedave
On Sunday, February 24, 2013 12:50:02 PM UTC-8, Mark Lawrence wrote:
 On 24/02/2013 20:28, llanitedave wrote:
 
  On Sunday, February 24, 2013 1:35:31 AM UTC-8, Chris Rebert wrote:
 
  On Feb 24, 2013 1:21 AM, llanitedave llani...@veawb.coop wrote:
 
 
 
 
 
 
 
  I created an html help page for my Python 2.7.3 application and put it in 
  a documentation folder.  I used webbrowser.open() to fetch the page.
 
 
 
 
 
 
 
  On linux -- KDE specifically, the command opens the local file on my 
  default browser with no issues.  However, on Windows 7, it opens Internet 
  Explorer, which doesn't even search the local folder, but goes straight 
  to the web and does a Google search, returning nothing but useless noise.
 
 
 
 
 
 
 
 
 
  My default browser on Windows is Chrome, so my intention is getting 
  undermined right from the start.
 
 
 
 
 
 
 
  How do I get a local html file to open properly from Python in Windows?
 
 
 
  Sounds like this might be your problem:
 
 
 
  http://bugs.python.org/issue8936
 
 
 
  The fix would seem to be ensuring that the URL you pass includes the 
  scheme (in your case, file:).
 
 
 
  Cheers,
 
 
 
  Chris
 
 
 
  Holy Toledo!  That's a two-year-old bug spanning two versions of the 
  language!
 
 
 
 Only two years is nothing.  Pay your money, take your choice :)
 
 
 
  This to me illustrates the downside of the Python philosophy of There 
  should be only one obvious way to do things.  If that one obvious way has 
  a fatal bug, you're pretty much SOL.
 
 
 
 Misquoted as always.  I guess that some day someone will quote it correctly.
 
 
 
 -- 
 
 Cheers.
 
 
 
 Mark Lawrence

I think the correct quote is You pays your money, and you takes your chances. 
 ;)
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread MRAB

On 2013-02-24 20:28, llanitedave wrote:

On Sunday, February 24, 2013 1:35:31 AM UTC-8, Chris Rebert wrote:

[snip]

Sounds like this might be your problem:

http://bugs.python.org/issue8936

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


Holy Toledo!  That's a two-year-old bug spanning two versions of the
language!

BTW, Chris, the snippet I showed in the title essentially WAS the
exact code.  It's a method with that single line called from a
wxPython Help menu.  I can't really put an absolute pathname into the
argument, because the application is going to be distributed to a
variety of computers at my workplace, and there's no assurance that
it will go into (or remain in)a particular folder.

I was trying to avoid using the wx.html.HtmlWindow feature of
wxPython, because it doesn't handle CSS and styles.  My help page is
the portal to a multi-page users guide with a style sheet to render
all the content consistently.

Plus, I couldn't get the wx.html.HtmlWindow to open relative paths
either -- it gave me URL Malformed messages even in KDE, when
webbrowser.open(filepath) was working for the exact same path.  But
that's something to take up on the wxPython list, I guess.

This to me illustrates the downside of the Python philosophy of
There should be only one obvious way to do things.  If that one
obvious way has a fatal bug, you're pretty much SOL.

I've had a brief look at webbrowser.py. It's looking for the browsers in 
the paths listed in the PATH environment variable.


On my PC at least, the paths to the other browsers, such as C:\Program
Files\Mozilla Firefox for Firefox, aren't listed there, hence the only
one it can find is Internet Explorer.
--
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread Demian Brecht
For the record, I completely misread and misunderstood the question. I
should stop posting that late at night :P

On Sun, Feb 24, 2013 at 1:25 AM, Demian Brecht demianbre...@gmail.com wrote:
 Rather than using a relative path, try using
 webbrowser.open('{}/documentation/help.html'.format(os.path.dirname(__file__))).

 On Sun, Feb 24, 2013 at 1:17 AM, llanitedave llanited...@veawb.coop wrote:
 I created an html help page for my Python 2.7.3 application and put it in a 
 documentation folder.  I used webbrowser.open() to fetch the page.

 On linux -- KDE specifically, the command opens the local file on my default 
 browser with no issues.  However, on Windows 7, it opens Internet Explorer, 
 which doesn't even search the local folder, but goes straight to the web and 
 does a Google search, returning nothing but useless noise.

 My default browser on Windows is Chrome, so my intention is getting 
 undermined right from the start.

 How do I get a local html file to open properly from Python in Windows?
 --
 http://mail.python.org/mailman/listinfo/python-list



 --
 Demian Brecht
 http://demianbrecht.github.com



--
Demian Brecht
http://demianbrecht.github.com
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread llanitedave
On Sunday, February 24, 2013 2:15:10 PM UTC-8, MRAB wrote:
 On 2013-02-24 20:28, llanitedave wrote:
 
  On Sunday, February 24, 2013 1:35:31 AM UTC-8, Chris Rebert wrote:
 
 [snip]
 
  Sounds like this might be your problem:
 
 
 
  http://bugs.python.org/issue8936
 
 
 
  The fix would seem to be ensuring that the URL you pass includes
 
  the scheme (in your case, file:).
 
 
 
  Holy Toledo!  That's a two-year-old bug spanning two versions of the
 
  language!
 
 
 
  BTW, Chris, the snippet I showed in the title essentially WAS the
 
  exact code.  It's a method with that single line called from a
 
  wxPython Help menu.  I can't really put an absolute pathname into the
 
  argument, because the application is going to be distributed to a
 
  variety of computers at my workplace, and there's no assurance that
 
  it will go into (or remain in)a particular folder.
 
 
 
  I was trying to avoid using the wx.html.HtmlWindow feature of
 
  wxPython, because it doesn't handle CSS and styles.  My help page is
 
  the portal to a multi-page users guide with a style sheet to render
 
  all the content consistently.
 
 
 
  Plus, I couldn't get the wx.html.HtmlWindow to open relative paths
 
  either -- it gave me URL Malformed messages even in KDE, when
 
  webbrowser.open(filepath) was working for the exact same path.  But
 
  that's something to take up on the wxPython list, I guess.
 
 
 
  This to me illustrates the downside of the Python philosophy of
 
  There should be only one obvious way to do things.  If that one
 
  obvious way has a fatal bug, you're pretty much SOL.
 
 
 
 I've had a brief look at webbrowser.py. It's looking for the browsers in 
 
 the paths listed in the PATH environment variable.
 
 
 
 On my PC at least, the paths to the other browsers, such as C:\Program
 
 Files\Mozilla Firefox for Firefox, aren't listed there, hence the only
 
 one it can find is Internet Explorer.

Well, it's still very odd, because when I use wxPython's wx.html.HtmlWindow to 
click a web link, it DOES use the default browser, which is Chrome on my PC.  
It's just using the webbrowser.open() function that goes to IE.  Until then, 
I'd been suspecting that wx.html.HtmlWindow was using webbrowser.open() under 
the hood.  I guess not.

But wx.html.HtmlWindow doesn't work on relative paths, it seems (in neither 
Linux NOR Windows), so I'm not able to find a substitute as of yet.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread llanitedave
On Sunday, February 24, 2013 3:51:09 PM UTC-8, Demian Brecht wrote:
 For the record, I completely misread and misunderstood the question. I
 
 should stop posting that late at night :P
 
 
 
 On Sun, Feb 24, 2013 at 1:25 AM, Demian Brecht demianbre...@gmail.com wrote:
 
  Rather than using a relative path, try using
 
  webbrowser.open('{}/documentation/help.html'.format(os.path.dirname(__file__))).
 
 
 
  On Sun, Feb 24, 2013 at 1:17 AM, llanitedave llanited...@veawb.coop wrote:
 
  I created an html help page for my Python 2.7.3 application and put it in 
  a documentation folder.  I used webbrowser.open() to fetch the page.
 
 
 
  On linux -- KDE specifically, the command opens the local file on my 
  default browser with no issues.  However, on Windows 7, it opens Internet 
  Explorer, which doesn't even search the local folder, but goes straight to 
  the web and does a Google search, returning nothing but useless noise.
 
 
 
  My default browser on Windows is Chrome, so my intention is getting 
  undermined right from the start.
 
 
 
  How do I get a local html file to open properly from Python in Windows?
 
  --
 
  http://mail.python.org/mailman/listinfo/python-list
 
 
 
 
 
 
 
  --
 
  Demian Brecht
 
  http://demianbrecht.github.com
 
 
 
 
 
 
 
 --
 
 Demian Brecht
 
 http://demianbrecht.github.com

Well, between you and Chris, I think you've got me on the right track.  If 
things keep going like they are now, I should have it back under control in an 
hour or two.

So, thanks in advance for all of you!
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread llanitedave
Well, we can mark this one as solved.

Simple enough, actually -- thanks to Chris and Demian for leading me to water.

The following code works on both Linux and Windows 7:

def OnDocs(self, event):
Opens the User's Guide in the default web browser
fullpath = os.path.abspath('documentation/HTMLDocs/index.html')
url_link = file:/// + fullpath
webbrowser.open(url_link)

This allows both platforms to have their own idiosyncratic path structures 
without having to create separate code for each.  It even chooses the correct 
browser!

I learned some more about Python today, too. I'd never explored the 'os.' 
library before, and now I see things a little more clearly.

Thanks again, guys!
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread Terry Reedy

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

--
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread Terry Reedy

On 2/24/2013 3:28 PM, llanitedave wrote:


http://bugs.python.org/issue8936



Holy Toledo!  That's a two-year-old bug spanning two versions of the language!


We need more volunteers who will do the kind of careful review of 
report, doc, and code I just did. Feel free to help.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread llanitedave
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.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 5:26 PM, llanitedave llanited...@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
-- 
http://mail.python.org/mailman/listinfo/python-list