Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Windows': 0.02; 'board.': 0.05; '64-bit': 0.07; 'binary': 0.07; 'intel': 0.07; 'linux,': 0.07; 'subject:PEP': 0.07; 'subject:support': 0.07; '*is*': 0.09; '32-bit': 0.09; 'emulate': 0.09; 'handful': 0.09; 'parsing': 0.09; 'subject:using': 0.09; 'windows,': 0.09; 'python': 0.11; 'windows': 0.15; "'configure'": 0.16; 'accepts': 0.16; 'bsd': 0.16; 'chip': 0.16; 'contexts,': 0.16; 'default:': 0.16; 'magic': 0.16; 'portable': 0.16; 'simulate': 0.16; 'solaris,': 0.16; 'subject: \n ': 0.16; 'subject:API': 0.16; 'those,': 0.16; 'ignore': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; "hasn't": 0.19; "python's": 0.19; 'restrictions': 0.19; 'stefan': 0.19; 'things.': 0.19; 'thu,': 0.19; 'seems': 0.21; '>>>': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; "aren't": 0.24; 'days,': 0.24; 'lets': 0.24; 'library,': 0.24; "shouldn't": 0.24; 'subject: .': 0.24; 'java': 0.24; 'environment': 0.24; 'script': 0.25; 'certain': 0.27; 'header:In- Reply-To:1': 0.27; 'installed': 0.27; 'chris': 0.29; 'external': 0.29; 'am,': 0.29; 'generally': 0.29; 'unix': 0.29; 'went': 0.31; 'code': 0.31; 'that.': 0.31; 'concern': 0.31; 'once,': 0.31; 'os,': 0.31; 'figure': 0.32; "we're": 0.32; 'run': 0.32; 'running': 0.33; 'mac': 0.33; 'sense': 0.34; 'subject:from': 0.34; "can't": 0.35; 'etc': 0.35; 'but': 0.35; 'there': 0.35; 'library.': 0.36; 'behind': 0.37; 'changing': 0.37; 'too': 0.37; 'level': 0.37; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'space': 0.40; 'commands': 0.60; 'then,': 0.60; 'worry': 0.60; 'hope': 0.61; "you're": 0.61; 'times': 0.62; 'high': 0.63; 'maximum': 0.63; 'offering': 0.63; 'networking': 0.64; 'more': 0.64; 'different': 0.65; 'taking': 0.65; 'temporary': 0.65; 'charset:windows-1252': 0.65; 'between': 0.67; 'received:74.208': 0.68; 'facilities': 0.69; 'bulk': 0.74; 'behavior': 0.77; 'yourself': 0.78; '2015': 0.84; 'completely,': 0.84; 'differences,': 0.84; 'does?': 0.84; 'omission': 0.84; 'one;': 0.84; 'precious': 0.84; 'received:74.208.4.194': 0.84; 'subject:skip:F 10': 0.84; 'whopping': 0.84; 'care,': 0.91; 'facilities.': 0.91; 'reasoning': 0.91; 'shell,': 0.91 Date: Thu, 07 May 2015 07:28:09 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API References: <554AB8A5.708@davea.name> <554adcf8$0$11103$c3e8da3@news.astraweb.com> <1c51085e-7795-4afc-9a4c-ad8b3f3a73a6@googlegroups.com> <87ioc4k89v.fsf@elektro.pacujo.net> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:2QNVbPpSYs4zP+tDFyy39KzF6bS0KCVaY1runB/HavqmMnueRrD kzPM/I6JWJ+7HgHtWAQqOwWWn5Wo31E6+XFIMAfHhgt/Q8gEfVSI4ZBkyFJcd2bDVtg30Id V7w/yeXt8yA8E6gYJMa0hq4eLnWEbeMvx5prbdK3QKOWz8FuLnx5Lb7kuFflSfOjfD8Y61S cBFw84gGdkmivNTBUeMIQ== X-UI-Out-Filterresults: notjunk:1; X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430998103 news.xs4all.nl 2898 [2001:888:2000:d::a6]:45063 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90097 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, write OS-dependent Python code. >> >> I don't think it's Python's job to pave over OS differences. Java does >> that by not offering precious system facilities -- very painful. Python >> is taking steps in that direction, but I hope it won't go too far. > > On the contrary, I think it *is* a high level language's job to pave > over those differences. Portable C code generally has to have a > whopping 'configure' script that digs into your hardware, OS, library, > etc availabilities, and lets you figure out which way to do things. > Python code shouldn't need to worry about that. You don't need to care > whether you're on a 32-bit or 64-bit computer; you don't need to care > whether it's an Intel chip or a RISCy one; you shouldn't have to > concern yourself with the difference between BSD networking and > WinSock. There'll be a handful of times when you do care, and for > those, it's nice to have some facilities exposed; but the bulk of code > shouldn't need to know about the platform it's running on. > > Java went for a philosophy of "write once, run anywhere" in its early > days, and while that hasn't exactly been stuck to completely, it's > still the reasoning behind the omission of certain system facilities. > Python accepts and understands that there will be differences, so you > can't call os.getuid() on Windows, and there are a few restrictions on > the subprocess module if you want maximum portability, but the bulk of > your code won't be any different on Linux, Windows, Mac OS, OS/2, > Amiga, OS/400, Solaris, or a MicroPython board. > > ChrisA > 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? Seems to me that's what shell=True is for. it signals Python that we're willing to trust the shell to do whatever magic it chooses, from adding extensions, to calling interpreters, to changing search order, to parsing the line in strange ways, to setting up temporary environment contexts, etc. If there were just one shell, it might make sense to emulate its features. Or it might make sense to contort its features to look like a Unix shell. But with multiple possibilities, seems that's more like space for a 3rd party library. -- DaveA