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


Groups > comp.lang.python > #39791

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

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'essentially': 0.04; 'apis': 0.07; 'problem:': 0.07; 'subject:Windows': 0.09; 'python': 0.09; 'argument,': 0.09; 'compute': 0.09; 'fetch': 0.09; 'snippet': 0.09; 'toss': 0.09; 'useless': 0.09; 'bug': 0.10; 'cc:addr:python-list': 0.10; 'properly': 0.15; '*only*': 0.16; '2.7.3': 0.16; '24,': 0.16; 'batteries': 0.16; 'bug,': 0.16; 'chris,': 0.16; 'chrome,': 0.16; 'dislike': 0.16; 'downside': 0.16; 'fatal': 0.16; 'folder,': 0.16; 'folder.': 0.16; 'holy': 0.16; 'illustrates': 0.16; 'investigate': 0.16; 'menu.': 0.16; 'pathname': 0.16; 'windows?': 0.16; 'wxpython': 0.16; 'wrote:': 0.17; 'fix': 0.17; 'tend': 0.17; '(in': 0.18; '(or': 0.18; 'windows': 0.19; 'feb': 0.19; 'code.': 0.20; 'versions': 0.20; 'sorry,': 0.22; 'cheers,': 0.23; 'cc:2**0': 0.23; 'absolute': 0.23; "python's": 0.23; "i've": 0.23; 'url:bugs': 0.24; 'linux': 0.24; 'command': 0.24; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '(which': 0.26; 'am,': 0.27; 'subject:skip:d 10': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'subject:/': 0.28; 'chris': 0.28; 'bad.': 0.29; 'issues.': 0.29; 'measure': 0.29; 'case,': 0.29; 'included': 0.29; 'probably': 0.29; 'relative': 0.30; 'function': 0.30; 'url:python': 0.32; 'file': 0.32; 'info': 0.32; 'getting': 0.33; 'message.': 0.33; 'goes': 0.33; 'page.': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'path': 0.35; 'returning': 0.35; 'open': 0.35; 'pm,': 0.35; 'really': 0.36; 'created': 0.36; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'method': 0.36; 'should': 0.36; 'does': 0.37; 'two': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'nothing': 0.38; 'url:docs': 0.38; 'page': 0.38; 'instead': 0.39; 'called': 0.39; 'google': 0.39; 'application': 0.40; 'skip:" 10': 0.40; 'help': 0.40; 'your': 0.60; 'safe': 0.63; 'search,': 0.65; 'due': 0.66; 'subject': 0.66; 'computers': 0.69; 'internet': 0.71; 'obvious': 0.71; 'sounds': 0.71; 'assurance': 0.74; '2013': 0.84; 'language!': 0.84; 'sender:addr:chris': 0.84; 'start.': 0.84; 'url:path': 0.84; 'hand,': 0.97
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7SgXCODQEWaiOyFyNj3qshlzHset1sazjsEqJHYtNg8=; b=XgvsZvUJOJO6wOz1bIWj1l7llqC2ReBrBpG5RIAbePAeeaNWTN9uX5xh4pSRb8EWRm 7ra/zDBpC0Gj/v2V30fT/b8gL4nxR3wvAFUQQY6wDehPLEio+93J+4tYmSA7DfNPxLX2 jPpoTotoAi7cbbI+uJQmud7yTkje6BobbtnNw=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=7SgXCODQEWaiOyFyNj3qshlzHset1sazjsEqJHYtNg8=; b=gULbXxketC72GWdyXKUTfw7EwQMDyg6XJJkvn9ZxYxlUK3MgU/BwNYJqK2Ah+HQUXy fcp3kXVkihfFaQXsARhYD+NdK6LK5JZk+563DQYANtuzil2Ez3PBqkmcFEx+15GmMxoF gCrahVF+m65YYmPgMAWSpZlhCyf2EyMJVV++d6qCr/LfW20klttjElTN7XjtU6tHZuyT I+me6SfzJj1U08RKR7pbMDIyPVEQHk30OiqMZNygIW77ArybElNknPUEHwLKTpHd0QpM 7FGT7fT/+/VbBFCdFpup/qol2EJptoN/YYXPsg0ewhlWZW64raDdeb/J2Hz+bhSYwnOC 9MRw==
MIME-Version 1.0
X-Received by 10.50.149.233 with SMTP id ud9mr2416707igb.92.1361738920787; Sun, 24 Feb 2013 12:48:40 -0800 (PST)
Sender chris@rebertia.com
In-Reply-To <5fbb36fe-a2b3-4ea6-a42e-53d46845865e@googlegroups.com>
References <659b4770-12fb-400f-8aa5-049605347fe2@googlegroups.com> <mailman.2401.1361698540.2939.python-list@python.org> <5fbb36fe-a2b3-4ea6-a42e-53d46845865e@googlegroups.com>
Date Sun, 24 Feb 2013 12:48:40 -0800
X-Google-Sender-Auth Ba3MxT_1ITNsFfzqktxrnVR3M4s
Subject Re: webbrowser.open("./documentation/help.html")-- No Go in Windows
From Chris Rebert <clp2@rebertia.com>
To llanitedave <llanitedave@veawb.coop>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Gm-Message-State ALoCoQm77xlHMCURIFA7LC6TlbpQ92Kfr3QtK8mitapc6wJNkfQh1g6lmBm/KIaBZSfF6E7NrCbi
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2437.1361738924.2939.python-list@python.org> (permalink)
Lines 53
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361738924 news.xs4all.nl 6859 [2001:888:2000:d::a6]:57906
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39791

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web