python 2.7.12 on Linux behaving differently than on Windows

BartC bc at
Mon Dec 5 10:41:45 EST 2016

On 05/12/2016 15:05, Chris Angelico wrote:
> On Tue, Dec 6, 2016 at 1:11 AM, BartC <bc at> wrote:
>> BTW what does Popen() do when one argument is '*.*'? Will that get expanded
>> to multiple extra arguments, and at what point will it be expanded?
> Nope. Popen is not a shell.
> It sounds as if you want a nerfed shell. Go ahead! I'm sure one
> exists. It'll frustrate you no end once you get used to a better
> shell, though - always does when I find myself on Windows...

That's not the point I was making.

Say you have this program

   import sys
   print (sys.argv)

And let's say there are just 3 files in the current directory:, and

If run from a Linux shell:

   python *

The output is: ['', '', ''] or something along those lines 
(there might be two copies of

Are you saying that if someone executes:

   subprocess.Popen(["python","", "*"])

the output will be: ['','*']?

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.

Or a program that sometimes will see "*" as an argument, and sometimes a 
big list of files that merges into all the other arguments.


More information about the Python-list mailing list