python -i

Paul Boddie paul at
Tue Oct 9 16:30:28 CEST 2001

epchaves at wrote:
> if i do: python -i
>          the output is OK: çççàààaaa
> but if i do: python
>         the output isn't the expected: ÇÇÇÀÀÀaaa

Could there be a file defined in the PYTHONSTARTUP environment
variable which makes it work as expected? Have you checked the
documentation to see which other start-up resources might be affecting
your results?

For what it's worth, using Python 2.0.1 on Windows NT 4.0, invoking
the lower method on a string of characters in an interactive session
within an MS-DOS window doesn't yield complete success:

>>> print "ÅÅÅØØØAAA".lower()

The same operation works both from within a script and interactively
in IDLE:

>>> print "ÅÅÅØØØAAA".lower()

It's virtually meaningless to test running a script with or without -i
at the MS-DOS prompt, given the strange characters that are returned,
but if one sends the output data to a file, one sees the same output
as in the first case above for both interactive and non-interactive
script execution.

Now, when I try Unicode, things work out a bit better. Here's my

  print u"ÅÅÅØØØAAA".lower().encode("cp1252")
  print u"ÅÅÅØØØAAA".lower().encode("iso8859-1")

Here are the results (for both with and without -i):


Sadly, this doesn't work interactively at the MS-DOS prompt, but it
does work in IDLE.

No, I don't know what all this means, unfortunately, apart from that
Unicode is the only thing you may be able to rely on, and that MS-DOS
boxes on Windows NT can't necessarily be trusted (hardly a big
surprise, that). That's not too surprising, given the potential for
ambiguity with standard character strings.


More information about the Python-list mailing list