Python subprocess Popen: Why does “ls *.txt” not work? [duplicate]
This question already has an answer here: Python subprocess wildcard usage 2 answers I was looking at this question. In my case, I want to do a : import subprocess p = subprocess.Popen(['ls', 'folder/*.txt'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() Now I can check on the commandline that doing a "ls folder/*.txt" works, as the folder has many .txt files. But in Python (2.6) I get: ls: cannot access * : No such file or directory I have tried doing: r'folder/\*.txt' r"folder/\*.txt" r'folder/\\*.txt' and other variations, but it seems Popen does not like the *