first correct explanation wins a beer...

My guess: Unicode. Try casting to an 8-bit string and see what happens.
Paul is right, so I guess you owe him a beer... To see this in more detail, compare popen2.Popen3("/bin/ls").fromchild.readlines() to popen2.Popen3(u"/bin/ls").fromchild.readlines() Specifically, it seems the problem is def _run_child(self, cmd): if type(cmd) == type(''): cmd = ['/bin/sh', '-c', cmd] in popen2. I still think there should be types.isstring function, and then this fragment should read def _run_child(self, cmd): if types.isstring(cmd): cmd = ['/bin/sh', '-c', cmd] Now, if somebody would put "funny characters" into cmd, it would still give an error, which is then almost silently ignored, due to the try: os.execvp(cmd[0], cmd) finally: os._exit(1) fragment. Perhaps it would be better to put if type(cmd) == types.UnicodeType: cmd = cmd.encode("ascii") into Popen3.__init__, so you'd get an error if you pass those funny characters. Regards, Martin
participants (1)
-
Martin v. Loewis