Invalid character in os.system call...

Hugh Macdonald HughMacdonald at brokenpipefilms.com
Sat Mar 20 12:28:39 EST 2004


I can across some very strange behaviour last week that I'm sure wasn't
happening before.... (this is all running under Linux)

I've got two scripts.... I'm going to cut them down to the problematic
parts:

script1:

import os
os.system("script2 -f ####.tif")


script2:

import sys
print sys.argv


Now, these look fine... However, when I run 'script1', I get the following
output from script2:

['script2', '-f']

But if I run the following from the command line:
script2 -f ####.tif

I get the following output:

['script2', '-f', '####.tif']

I'm sure it never used to do this, but it nicely killed one of my scripts,
and I only fixed it by changing the line in script1 to:

os.system("script2 -f \"####.tif\"")

I don't think I should need to do that, and I'm sure I didn't used to...

So what's going on? Is os.system() taking everything after the first '#' as
a comment, or is it the way the command-line is interpreting it?

Any comments on what's causing this would be welcome - it's not a problem,
but it confused me for a while.....


Hugh Macdonald





More information about the Python-list mailing list