Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72139
| Date | 2014-05-28 06:08 +0100 |
|---|---|
| From | Tim Golden <mail@timgolden.me.uk> |
| Subject | Re: Command prompt not shown when running Python script with subprocess on Windows |
| References | <29c26176-b573-4ac9-bf41-a18a53d7dfb9@googlegroups.com> <mailman.10362.1401175475.18130.python-list@python.org> <e88a0683-8332-4db7-934b-39d5efc6d436@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10382.1401253738.18130.python-list@python.org> (permalink) |
On 28/05/2014 00:01, ps16thypresenceisfullnessofjoy@gmail.com wrote: > I want users to be able to enter paths in the XML file exactly the > way they would be entered in a Windows shortcut. Since it is possible > to make a Windows shortcut for path-to-script.py without the > python.exe in front of it and have it open in its own command prompt, > I want to be able to do the same thing in my XML file, but this is > what I cannot figure out. Anything done through shortcuts is making use of the Windows Shell API. To mimic that behaviour, you could try using that; in this case, ShellExecute[Ex]. For simple purposes, this is exposed in Python as os.startfile. If you need more control, you'd have to use the API call directly, either via ctypes or via the pywin32 libraries under the win32com.shell package. To mimic the behaviour exactly (if that is a requirement), you could actually create a temporary shortcut with the desired information and invoke it via os.startfile. I haven't followed the thread (and I'm offline at the moment) so I'll wait until I've seen it before I comment on the shlex.split / \\ dance above. On the surface, though, I'm not sure what it's achieving. [All right, I didn't wait :)]. TJG
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Command prompt not shown when running Python script with subprocess on Windows ps16thypresenceisfullnessofjoy@gmail.com - 2014-05-26 17:03 -0700
Re:Command prompt not shown when running Python script with subprocess on Windows Dave Angel <davea@davea.name> - 2014-05-27 03:20 -0400
Re: Command prompt not shown when running Python script with subprocess on Windows Stephen Hansen <me+python@ixokai.io> - 2014-05-26 23:38 -0700
Re: Command prompt not shown when running Python script with subprocess on Windows ps16thypresenceisfullnessofjoy@gmail.com - 2014-05-27 16:01 -0700
Re: Command prompt not shown when running Python script with subprocess on Windows Tim Golden <mail@timgolden.me.uk> - 2014-05-28 06:08 +0100
Re: Command prompt not shown when running Python script with subprocess on Windows ps16thypresenceisfullnessofjoy@gmail.com - 2014-05-28 13:22 -0700
Re: Command prompt not shown when running Python script with subprocess on Windows Tim Golden <mail@timgolden.me.uk> - 2014-05-28 20:46 +0100
Re: Command prompt not shown when running Python script with subprocess on Windows ps16thypresenceisfullnessofjoy@gmail.com - 2014-05-28 13:46 -0700
Re: Command prompt not shown when running Python script with subprocess on Windows Tim Golden <mail@timgolden.me.uk> - 2014-05-29 12:41 +0100
Re: Command prompt not shown when running Python script with subprocess on Windows ps16thypresenceisfullnessofjoy@gmail.com - 2014-05-29 12:21 -0700
Re: Command prompt not shown when running Python script with subprocess on Windows Tim Golden <mail@timgolden.me.uk> - 2014-06-01 17:31 +0100
Re: Command prompt not shown when running Python script with subprocess on Windows ps16thypresenceisfullnessofjoy@gmail.com - 2014-06-04 13:25 -0700
csiph-web