X-Received: by 10.224.189.78 with SMTP id dd14mr6913557qab.0.1361739854994; Sun, 24 Feb 2013 13:04:14 -0800 (PST) X-Received: by 10.49.15.38 with SMTP id u6mr637866qec.8.1361739854833; Sun, 24 Feb 2013 13:04:14 -0800 (PST) Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!dd2no2734703qab.0!news-out.google.com!t2ni1342qaj.0!nntp.google.com!t2no4662235qal.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Sun, 24 Feb 2013 13:04:14 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.162.99.34; posting-account=aw7wEQoAAACnaP8vftI9MyiC9NfXNJyr NNTP-Posting-Host: 66.162.99.34 References: <659b4770-12fb-400f-8aa5-049605347fe2@googlegroups.com> <5fbb36fe-a2b3-4ea6-a42e-53d46845865e@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5ff13dfd-e53b-48c2-ac1a-d612c61c6970@googlegroups.com> Subject: Re: webbrowser.open("./documentation/help.html")-- No Go in Windows From: llanitedave Cc: llanitedave , Python Injection-Date: Sun, 24 Feb 2013 21:04:14 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 4994 Xref: csiph.com comp.lang.python:39794 On Sunday, February 24, 2013 12:48:40 PM UTC-8, Chris Rebert wrote: > On Sun, Feb 24, 2013 at 12:28 PM, llanitedave wr= ote: >=20 > > On Sunday, February 24, 2013 1:35:31 AM UTC-8, Chris Rebert wrote: >=20 > >> On Feb 24, 2013 1:21 AM, "llanitedave" wrote: >=20 > >> > 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. >=20 > >> > 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. >=20 > >> > My default browser on Windows is Chrome, so my intention is getting = undermined right from the start. >=20 > >> > How do I get a local html file to open properly from Python in Windo= ws? >=20 > >> >=20 > >> Sounds like this might be your problem: >=20 > >> http://bugs.python.org/issue8936 >=20 > >> >=20 > >> The fix would seem to be ensuring that the URL you pass includes the s= cheme (in your case, "file:"). >=20 > > >=20 > > Holy Toledo! That's a two-year-old bug spanning two versions of the la= nguage! >=20 > > >=20 > > BTW, Chris, the snippet I showed in the title essentially WAS the exact= code. >=20 >=20 >=20 > Sorry, my bad. This is why I dislike messages that put critical info >=20 > *only* in the subject line; I tend not to reread the subject line once >=20 > I've opened the message. >=20 Nah, my bad. I didn't realize that the title was the only place I'd put th= e actual command. I don't like it when other people do that either. >=20 >=20 > > 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 app= lication is going to be distributed to a variety of computers at my workpla= ce, and there's no assurance that it will go into (or remain in)a particula= r folder. >=20 >=20 >=20 > As Demian demonstrated, you can simply compute the absolute path from >=20 > the relative path at runtime; although I would probably toss an >=20 > abspath() call in for good measure >=20 > (http://docs.python.org/2/library/os.path.html#os.path.abspath ). >=20 >=20 OK, I'm going to have to study that one a bit. It looks like a new concept= for my feeble brain. >=20 > > 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. >=20 >=20 >=20 > On the other hand, you don't have to investigate which of N APIs is >=20 > the "fixed"/"correct" one (Which PHP MySQL function is safe from SQL >=20 > injection again?), and you only have wait for 1 fix instead of N. But >=20 > yes, some of Python's included batteries are due for some recharging. >=20 >=20 >=20 > Cheers, >=20 > 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 fi= x at that time. The fact that it's still not fixed implies that it might b= e something that's really hard to pin down. In a case like that, it's prob= ably better to simply withdraw the feature, or tag it as "Non-windows only"