[docs] Interface option "-c"
Josh.Hodson at ATK.COM
Wed Sep 21 15:51:01 CEST 2011
I tried to use the "-c" option to run a script called "a" with a method called "Test()", and received an error message as follows:
S:\>python -c "import a\n a.Test()"
File "<string>", line 1
import a\n a.Test()
SyntaxError: unexpected character after line continuation character
If I replace the "\n" with a semicolon, then it works. Documentation for the interface option "-c" reads (http://docs.python.org/using/cmdline.html#command-line):
Execute the Python code in command. command can be one or more statements separated by newlines, with significant leading whitespace as in normal module code.
I am running 64-bit Python27 on Windows Vista. I have not tried this with any other version of Python or on any other platform. In my personal opinion, the semicolon is cleaner than the '\n' anyway, so I would prefer that the documentation just be updated to say "separated by semicolons" instead of "separated by newlines", but that is assuming all other versions of Python on all platforms behave the same.
Joshua D. Hodson
ATK Aerospace Systems
josh.hodson at atk.com<mailto:josh.hodson at atk.com>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the docs