[Tutor] Run script automatically in IDLE shell

Kent Johnson kent37 at tds.net
Thu Dec 8 01:20:49 CET 2005


Yann Le Du wrote:

> P.S. I do all this to have accentuated characters (French) correctly 
> displayed, and this is done in the IDLE Shell, but fails inside the DOS 
> window. So this is why I want to have my scripts run directly inside the 
> IDLE shell...

The DOS shell uses code page 437 while IDLE uses Cp1252. Most likely you 
have data in Cp1252 (or latin-1, which is almost the same). When you 
write it to the shell in IDLE it is fine because IDLE expects it. When 
you write it to the DOS shell it is misinterpreted as Cp437 and the 
wrong characters print.

Try setting the DOS shell to Cp1252 with the command
  > chcp 1252
before you run your Python program.

For more details see
http://www.pycs.net/users/0000323/stories/14.html

Kent



More information about the Tutor mailing list