Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39739 > unrolled thread
| Started by | llanitedave <llanitedave@veawb.coop> |
|---|---|
| First post | 2013-02-24 01:17 -0800 |
| Last post | 2013-02-24 22:26 -0800 |
| Articles | 20 on this page of 26 — 8 participants |
Back to article view | Back to comp.lang.python
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 1 of 2 [1] 2 Next page →
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 01:17 -0800 |
| Subject | webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <659b4770-12fb-400f-8aa5-049605347fe2@googlegroups.com> |
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?
[toc] | [next] | [standalone]
| From | Chris Rebert <clp2@rebertia.com> |
|---|---|
| Date | 2013-02-24 01:24 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2399.1361697898.2939.python-list@python.org> |
| In reply to | #39739 |
[Multipart message — attachments visible in raw view] — view raw
On Feb 24, 2013 1:21 AM, "llanitedave" <llanitedave@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
[toc] | [prev] | [next] | [standalone]
| From | Demian Brecht <demianbrecht@gmail.com> |
|---|---|
| Date | 2013-02-24 01:25 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2400.1361697924.2939.python-list@python.org> |
| In reply to | #39739 |
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 <llanitedave@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
[toc] | [prev] | [next] | [standalone]
| From | Chris Rebert <clp2@rebertia.com> |
|---|---|
| Date | 2013-02-24 01:35 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2401.1361698540.2939.python-list@python.org> |
| In reply to | #39739 |
[Multipart message — attachments visible in raw view] — view raw
On Feb 24, 2013 1:21 AM, "llanitedave" <llanitedave@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
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 12:28 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <5fbb36fe-a2b3-4ea6-a42e-53d46845865e@googlegroups.com> |
| In reply to | #39742 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2013-02-24 20:50 +0000 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2435.1361738799.2939.python-list@python.org> |
| In reply to | #39782 |
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
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 13:06 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <62f8976a-12b4-4e54-92af-27bc920a3273@googlegroups.com> |
| In reply to | #39789 |
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". ;)
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 13:06 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2440.1361739992.2939.python-list@python.org> |
| In reply to | #39789 |
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". ;)
[toc] | [prev] | [next] | [standalone]
| From | Chris Rebert <clp2@rebertia.com> |
|---|---|
| Date | 2013-02-24 12:48 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2437.1361738924.2939.python-list@python.org> |
| In reply to | #39782 |
On Sun, Feb 24, 2013 at 12:28 PM, llanitedave <llanitedave@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
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 13:04 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <5ff13dfd-e53b-48c2-ac1a-d612c61c6970@googlegroups.com> |
| In reply to | #39791 |
On Sunday, February 24, 2013 12:48:40 PM UTC-8, Chris Rebert wrote: > On Sun, Feb 24, 2013 at 12:28 PM, llanitedave <llanitedave@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"
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 13:04 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2439.1361739865.2939.python-list@python.org> |
| In reply to | #39791 |
On Sunday, February 24, 2013 12:48:40 PM UTC-8, Chris Rebert wrote: > On Sun, Feb 24, 2013 at 12:28 PM, llanitedave <llanitedave@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"
[toc] | [prev] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2013-02-24 22:15 +0000 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2445.1361744102.2939.python-list@python.org> |
| In reply to | #39782 |
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.
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 17:03 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <73edf7f8-8dbb-4049-bc88-692bb098d69a@googlegroups.com> |
| In reply to | #39804 |
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.
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 17:03 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2484.1361759307.2939.python-list@python.org> |
| In reply to | #39804 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2013-02-25 00:36 -0500 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2489.1361770790.2939.python-list@python.org> |
| In reply to | #39782 |
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
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 12:28 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2429.1361737707.2939.python-list@python.org> |
| In reply to | #39742 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Demian Brecht <demianbrecht@gmail.com> |
|---|---|
| Date | 2013-02-24 15:51 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2460.1361749878.2939.python-list@python.org> |
| In reply to | #39739 |
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 <demianbrecht@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 <llanitedave@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
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 18:26 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <db81ab06-dcf6-471b-a6a4-6a0f7a6d01a9@googlegroups.com> |
| In reply to | #39823 |
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 <demianbrecht@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 <llanitedave@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!
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 18:26 -0800 |
| Subject | Re: webbrowser.open("./documentation/help.html")-- No Go in Windows |
| Message-ID | <mailman.2483.1361759222.2939.python-list@python.org> |
| In reply to | #39823 |
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 <demianbrecht@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 <llanitedave@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!
[toc] | [prev] | [next] | [standalone]
| From | llanitedave <llanitedave@veawb.coop> |
|---|---|
| Date | 2013-02-24 19:37 -0800 |
| Message-ID | <bfaa3177-449f-4d41-99e3-c2763c42c1e5@googlegroups.com> |
| In reply to | #39739 |
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!
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.python
csiph-web