Invoking Python from Cygwin problem.
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Sat Nov 25 06:14:28 EST 2006
In <1164385876.755749.139020 at l39g2000cwd.googlegroups.com>, Ant wrote:
> ----------------------------------------------------------------------------------
> #!/usr/bin/python
> print "Testing",
>
> Running the bash script, I get the following output:
>
> OKt var: Testing
> Test var2: Test2 OK
>
> Does anyone have any idea why the script would mess up the first echo?
> Are there some kind of control characters being appended to the python
> output in Windows? Looks like a CR character, but why?
It's a feature. The `sys.stdout` object remembers if the last ``print``
ended in a comma (see the `sys.stdout.softspace` attribute) and when the
interpreter executes its shutdown code and that `softspace` attribute is
set, an extra '\n' is printed.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list