On Tue, 6 Dec 2016 02:41 am, BartC wrote: > In that case forget Windows vs. Linux, you now have a program that will > get command parameters processed differently depending on whether it was > invoked from a shell or not.
Er, yeah? You say that as if it were a bad thing. Look at it this way. Suppose you were a really cunning system administrator who spent 8 or 10 hours a day typing in commands and arguments that were frequently file names. So you built yourself a macro system where you type a command: foo bar baz and the macro would walk through the command line, automatically expanding environment variables and file name globs. And because you used this 95% of the time, and it was intended as a convenience for interactive use, you linked the macro to the Enter key, so that only a single key press was needed to do this processing. But of course you're not an idiot, you know full well that there are occasions where you want to avoid the expansion. So you include commands to disable and enable that macro, and to give you even more fine-grained control of what is expanded where, you build it escaping mechanisms so that you can expand part of the command line and not other parts. And then I come along, full of righteous indignation, and start yelling "Wait a minute, now your application gets its command parameters processed differently depend on whether you called it from C or used your macro!" And you would answer: "Of course it does, that's the whole bloody point of the macro!" (By the way, I think that you will find that when you call Popen, if you set shell=True it will be invoked in a subshell, which means you'll get the full shell experience including command expansion. For good and evil. That's a security risk, if you're getting the arguments from an untrusted source, so don't pass shell=True unless you know what you're doing.) -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list