Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78298 > unrolled thread
| Started by | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| First post | 2014-09-24 17:41 +0100 |
| Last post | 2014-09-24 17:41 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: why can't open the file with browser? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-24 17:41 +0100
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-09-24 17:41 +0100 |
| Subject | Re: why can't open the file with browser? |
| Message-ID | <mailman.14323.1411576932.18130.python-list@python.org> |
On 24/09/2014 13:22, Chris Angelico wrote:
> On Wed, Sep 24, 2014 at 7:32 PM, luofeiyu <elearn2014@gmail.com> wrote:
>> import webbrowser webbrowser.open('f:\\test.html') why the file
>> f:\\test.html is opened by notepad ,not by my firefox or chrome?
>
> It looks to me as if your default association is set to Notepad rather
> than a web browser. Try opening one of the browsers' settings pages
> and making it your default browser. In Chrome, that's
> chrome://settings/ and it's near the bottom; in Firefox, go to
> Tools|Options, Advanced, and it's on the General tab. (They might
> check on startup and offer to make themselves default, which would
> save you some trouble.)
>
> ChrisA
>
From
https://docs.python.org/3/library/webbrowser.html#module-webbrowser
"Note that on some platforms, trying to open a filename using this
function, may work and start the operating system’s associated program.
However, this is neither supported nor portable." So it looks like a
case of changing the file association through control panel or similar.
I'll leave the OP to find out how to do that as an exercise.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
Back to top | Article view | comp.lang.python
csiph-web