python 2.7.12 on Linux behaving differently than on Windows

Chris Angelico rosuav at gmail.com
Mon Dec 5 10:53:53 EST 2016


On Tue, Dec 6, 2016 at 2:41 AM, BartC <bc at freeuk.com> wrote:
>
> Are you saying that if someone executes:
>
>   subprocess.Popen(["python","a.py", "*"])
>
> the output will be: ['a.py','*']?
>
> 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.

Yes, that is correct. *SHELLS DO STUFF*. If you can't comprehend this,
you should get to know your shell. Try this:

python a.py %PATH%

subprocess.Popen(["python", "a.py", "%PATH%"])

Would you expect those to do the same? If you do, prepare for Windows
to surprise you. If you don't, why do you keep expecting other shells
to do nothing?

ChrisA



More information about the Python-list mailing list