Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Marko Rauhamaa
Ben Finney : > Chris Angelico writes: > >> On Fri, May 8, 2015 at 1:24 AM, Marko Rauhamaa wrote: >> >> That's Python's job. Abstracting away all those differences so you >> >> don't have to look at them. >> > >> > That's the difference between our opinions: you want Python to work >> > the same

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Ben Finney
Chris Angelico writes: > On Fri, May 8, 2015 at 1:24 AM, Marko Rauhamaa wrote: > >> That's Python's job. Abstracting away all those differences so you > >> don't have to look at them. > > > > That's the difference between our opinions: you want Python to work > > the same on different OS's. I wa

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Chris Angelico
On Fri, May 8, 2015 at 1:24 AM, Marko Rauhamaa wrote: >> That's Python's job. Abstracting away all those differences so you >> don't have to look at them. > > That's the difference between our opinions: you want Python to work the > same on different OS's. I want Python's system programming facili

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Chris Angelico
On Fri, May 8, 2015 at 1:14 AM, Ian Kelly wrote: > On Thu, May 7, 2015 at 8:03 AM, Chris Angelico wrote: >> On Thu, May 7, 2015 at 11:44 PM, Marko Rauhamaa wrote: >>> Whole programming cultures, idioms and "right ways" differ between >>> platforms. What's the right way to write a service (daemon

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Stefan Zimmermann
Marko Rauhamaa wrote: > Anyway, Python has os.system() that does the quick and dirty thing you > might be looking for. Always invokes shell ==> overhead for .exe files -- https://mail.python.org/mailman/listinfo/python-list

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Marko Rauhamaa
Stefan Zimmermann : > Calling an external command should be one of the simplest tasks in a > high level scripting language like Python. Actually, that's quite a tricky operation in any OS. For example, bash's simplicity is a trap that claims a lot of victims. Anyway, Python has os.system() that

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Stefan Zimmermann
This discussion is getting really interesting and far beyond the actual topic :) I want to add some additional thoughts on Popen: Marko Rauhamaa wrote: > Stefan Zimmermann: > > > And last but not least, Popen behavior on Windows makes it difficult > > to write OS-independent Python code which cal

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Marko Rauhamaa
Chris Angelico : > What's the best way to farm work off to a bunch of processes and have > them communicate their results back? You use the subprocess module, > and then it doesn't matter whether they use Unix sockets, named pipes, > physical files on the disk, or miniature nuclear explosions, the

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Ian Kelly
On Thu, May 7, 2015 at 8:03 AM, Chris Angelico wrote: > On Thu, May 7, 2015 at 11:44 PM, Marko Rauhamaa wrote: >> Whole programming cultures, idioms and "right ways" differ between >> platforms. What's the right way to write a service (daemon)? That's >> probably completely different between Wind

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Chris Angelico
On Thu, May 7, 2015 at 11:44 PM, Marko Rauhamaa wrote: > Chris Angelico : > >>> A software system is defined through its interfaces. >> >> And the most important interface is with a human. > > I barely ever program anything for the human interface. > >> If you want to write single-platform code, g

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Marko Rauhamaa
Chris Angelico : >> A software system is defined through its interfaces. > > And the most important interface is with a human. I barely ever program anything for the human interface. > If you want to write single-platform code, go for it; but if you want > to write cross-platform code, the best

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Chris Angelico
On Thu, May 7, 2015 at 10:41 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> I was specifically disagreeing with the notion that it's right and >> normal to write a bunch of platform-specific code in Python. That >> should be the rarity. > > Why is that? > > Code is written for a specific need a

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Marko Rauhamaa
Chris Angelico : > I was specifically disagreeing with the notion that it's right and > normal to write a bunch of platform-specific code in Python. That > should be the rarity. Why is that? Code is written for a specific need and environment. Often trying to write generic solutions leads to cum

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Chris Angelico
On Thu, May 7, 2015 at 9:28 PM, Dave Angel wrote: > It's a nice goal. But these aren't OS features in Windows, they're shell > features. And there are several shells. If the user has installed a > different shell, is it Python's job to ignore it and simulate what cmd.exe > does? It might be an

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Dave Angel
On 05/07/2015 06:24 AM, Chris Angelico wrote: On Thu, May 7, 2015 at 8:10 PM, Marko Rauhamaa wrote: Stefan Zimmermann : And last but not least, Popen behavior on Windows makes it difficult to write OS-independent Python code which calls external commands that are not binary by default: Then

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Chris Angelico
On Thu, May 7, 2015 at 8:10 PM, Marko Rauhamaa wrote: > Stefan Zimmermann : > >> And last but not least, Popen behavior on Windows makes it difficult >> to write OS-independent Python code which calls external commands that >> are not binary by default: > > Then, write OS-dependent Python code. >

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Marko Rauhamaa
Stefan Zimmermann : > And last but not least, Popen behavior on Windows makes it difficult > to write OS-independent Python code which calls external commands that > are not binary by default: Then, write OS-dependent Python code. I don't think it's Python's job to pave over OS differences. Java

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Stefan Zimmermann
And last but not least, Popen behavior on Windows makes it difficult to write OS-independent Python code which calls external commands that are not binary by default: 2 examples: 1. I wrote a coffeetools package which wraps the CoffeeScript compiler in a Python API. The 'coffee' command is a N

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Stefan Zimmermann
Nice to see that my topic gains that interest :) And I see that I should have gone more into detail about what I'm actually trying to point out. Chris Angelico wrote: > Hmm... hm... Ha! Found the difference. I had an explicit shebang on my > script; yours just starts out with shell commands. That

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-07 Thread Gisle Vanem
Chris Angelico wrote: There's a specific search order. Back in the days of DOS, it was simply "com, then exe, then bat", but on modern Windowses, I think it's governed by an environment variable. You probably mean '%PATHEXT'. Mine is: .COM;.EXE;.BAT;.BTM;.CMD;.JS;.JSE;.WSF;.WSH;.MSC;.tcl;.py;

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Chris Angelico
On Thu, May 7, 2015 at 1:33 PM, Steven D'Aprano wrote: > On Thursday 07 May 2015 12:19, Chris Angelico wrote: > >> On Thu, May 7, 2015 at 10:58 AM, Dave Angel wrote: >>> There's nothing Windows-specific about that behaviour. In Linux, there >>> are >>> bash commands that can only be run by using

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Steven D'Aprano
On Thursday 07 May 2015 12:19, Chris Angelico wrote: > On Thu, May 7, 2015 at 10:58 AM, Dave Angel wrote: >> There's nothing Windows-specific about that behaviour. In Linux, there >> are >> bash commands that can only be run by using shell=True. Fortunately >> Popen didn't make the mistake of p

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Chris Angelico
On Thu, May 7, 2015 at 10:58 AM, Dave Angel wrote: > There's nothing Windows-specific about that behaviour. In Linux, there are > bash commands that can only be run by using shell=True. Fortunately Popen > didn't make the mistake of pretending it's a shell. But bash commands aren't the same as

Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Dave Angel
On 05/06/2015 06:11 PM, Stefan Zimmermann wrote: Hi. I don't like that subprocess.Popen(['command']) only works on Windows if there is a command.exe in %PATH%. As a Windows user you would normally expect that also command.bat and command.cmd can be run that way. and command.com. If it'

PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

2015-05-06 Thread Stefan Zimmermann
Hi. I don't like that subprocess.Popen(['command']) only works on Windows if there is a command.exe in %PATH%. As a Windows user you would normally expect that also command.bat and command.cmd can be run that way. There are simple workarounds like Popen(..., shell=True) but that is a heavy ove