Invalid character in os.system call...

Mathias Waack M.Waack at gmx.de
Sun Mar 21 10:19:41 EST 2004


Hugh Macdonald wrote:

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

This looks ugly (its just my personal opinion). Because in Python its
possible to use both ' and " as string markers, you can write:

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

> 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?

Yes, just try the following on the shell-prompt: 

$ echo hello # you

Thats the problem of os.system - everything goes thru the shell. 

Mathias



More information about the Python-list mailing list