Running into problems with os.popen

John Hazen python-list at hazen.net
Thu Mar 20 19:29:43 EST 2003


On Thu, Mar 20, 2003 at 07:02:06AM -0600, Stephen Boulet wrote:

> The command is:
> 
> pth = os.path.join(curDir,self.fileName)
> command = 'hdp dumpsds -c "%s"' % pth

If the filename (or any of the directories on the path) has a
space in it, the shell (depending on your OS) may split what you
*mean* as one argument into two.

If that's the kind of truncation you're talking about, try this:

command = "hdp dumpsds -c '%s'" % pth

Even though they're the same to python, to the shell single quotes will
contain the space, while double quotes will not.

HTH-

John





More information about the Python-list mailing list