Spawn/Exec with asterisk in argument
jeremyfee at gmail.com
jeremyfee at gmail.com
Wed Apr 18 20:35:43 EDT 2007
The spawn* and exec* functions appear to escape asterisks, I'm
guessing all shell characters too, before the spawn/exec'ed process
sees them. Is there a way around this?
Not sure if this is a bug or a "feature".
user$ touch test.txt
user$ ls -l *
-rw-r--r-- 1 user user 0 Apr 18 18:30 test.txt
user$ ls -l \*
ls: *: No such file or directory
user$ python
Python 2.3.5 (#1, Aug 12 2006, 00:08:11)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.system("ls -l *")
-rw-r--r-- 1 user user 0 Apr 18 18:30 test.txt
0
>>> os.spawnvp(os.P_WAIT, "ls", ("ls", "-l", "*"))
ls: *: No such file or directory
1
More information about the Python-list
mailing list