New submission from Terry J. Reedy <tjre...@udel.edu>: webbrowser.open (and two aliases):
1. document return value, which seems to be: True if a browser tab or window is opened, regardless of whether or not the url is found; False otherwise. 2. document that (on Windows, at least) the default browser only gets used if a non .htm(l) url starts with 'www' or 'http:'. This is true because os.startfile(url) apparently only works if above is true, as required for the Start/Run box to recognize an entry as a url. In particular, I have Firefox as default and 'www.google.com' and 'http://bugs.python.org' get opened in Firefox (new tab as requested). However, 'google.com' and 'bugs.python.org' open with IE after some delay. [Start/run either opens with Firefox or reports 'cannot find'.] ----- In the longer run, what I would really like is for webbrowser to be better at using the default or finding executables. I thought of adding 'http://' if not present but that would disable opening files in a file browser. I suspect there is a registry entry but do not know what it is. That would also pick up new browswers like Chrome. It seems to me that the current behavior is a 'limitation' in this code: # Detect some common Windows browsers, fallback to IE iexplore = os.path.join(os.environ.get("PROGRAMFILES", "C:\\Program Files"), "Internet Explorer\\IEXPLORE.EXE") for browser in ("firefox", "firebird", "seamonkey", "mozilla", "netscape", "opera", iexplore): if _iscommand(browser): register(browser, None, BackgroundBrowser(browser)) Firefox is not being recognized as a command because _iscommand('firefox') does not not see firefox.exe as an executable because it only checks _isexecutable() in the hodgepodge list of paths in PATH. At one time (but no longer), executables were ofter put in c:/windows, which by default is in PATH. Since you hardcoded the default real path for iexplore (C:\\Program Files\\"Internet Explorer\\IEXPLORE.EXE"), you could do the same for other programs: firefox = os.path.join(os.environ.get("PROGRAMFILES", "C:\\Program Files"), "Mozilla Firefox\\firefox.exe") ---------- assignee: georg.brandl components: Library (Lib) messages: 124949 nosy: georg.brandl, terry.reedy priority: normal severity: normal stage: needs patch status: open title: Improve webbrowser.open doc (and, someday, behavior?) versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10799> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com