Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101564
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: use Python and an outlook: protocol URL to bring up a specific email |
| Date | 2016-01-13 04:52 +1100 |
| Message-ID | <mailman.79.1452621162.13488.python-list@python.org> (permalink) |
| References | <ab47c98f-69af-49ee-b1c4-bced0c48a001@googlegroups.com> <CAPTjJmpjk+LVUmV9orqvVVmbWNXzsBYKO+be3A8P62znZZF5kQ@mail.gmail.com> <CACL+1auQXdkXyV0J22nKpOxt0ZLEGdkvHzxc-Mp2MfiJXsW_ug@mail.gmail.com> |
On Wed, Jan 13, 2016 at 4:37 AM, eryk sun <eryksun@gmail.com> wrote:
> On Tue, Jan 12, 2016 at 11:10 AM, Chris Angelico <rosuav@gmail.com> wrote:
>> On Wed, Jan 13, 2016 at 3:51 AM, jkn <jkn_gg@nicorp.f9.co.uk> wrote:
>>> I happy to carve some code without using urllib, but I am not clear what I
>>> actually need to do to 'open' such a URL using this protocol. FWIW I can paste
>>> this URL into Windows Explorer and I get the referenced email popping up ;-)
>>
>> What happens if you invoke the 'start' command using subprocess?
>>
>> subprocess.check_call(["start", url])
>>
>> In theory, that should be equivalent to pasting it into Explorer. In theory.
>
> start is a shell command. It also has a quirk that the first quoted
> argument is the window title. Here's the correct call:
>
> subprocess.check_call('start "title" "%s"' % url, shell=True)
Is that properly escaped to handle any arbitrary URL? I doubt it.
Do you actually need shell=True? I would strongly recommend using the
form that I used, unless it can be proven that that doesn't work.
> That said, since no arguments are being passed the simpler and more
> secure way to call ShellExecute in this case is os.startfile(url).
Yes. The OP mentioned having tried this, though, so I went for an alternative.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
use Python and an outlook: protocol URL to bring up a specific email jkn <jkn_gg@nicorp.f9.co.uk> - 2016-01-12 08:51 -0800
Re: use Python and an outlook: protocol URL to bring up a specific email Chris Angelico <rosuav@gmail.com> - 2016-01-13 04:10 +1100
Re: use Python and an outlook: protocol URL to bring up a specific email jkn <jkn_gg@nicorp.f9.co.uk> - 2016-01-12 09:22 -0800
Re: use Python and an outlook: protocol URL to bring up a specific email eryk sun <eryksun@gmail.com> - 2016-01-12 11:37 -0600
Re: use Python and an outlook: protocol URL to bring up a specific email Chris Angelico <rosuav@gmail.com> - 2016-01-13 04:52 +1100
Re: use Python and an outlook: protocol URL to bring up a specific email Christian Gollwitzer <auriocus@gmx.de> - 2016-01-12 19:04 +0100
Re: use Python and an outlook: protocol URL to bring up a specific email eryk sun <eryksun@gmail.com> - 2016-01-12 13:12 -0600
csiph-web