[Tutor] Changing the interpreter prompt symbol from ">>>" to ???

Cameron Simpson cs at zip.com.au
Sat Mar 12 03:14:10 EST 2016


On 12Mar2016 00:46, boB Stepp <robertvstepp at gmail.com> wrote:
>On Fri, Mar 11, 2016 at 11:02 PM, Cameron Simpson <cs at zip.com.au> wrote:
>>  0x25ba BLACK RIGHT-POINTING POINTER
>>
>> So it seems that your environment has chosen to transcribe your chr(26) and
>> chr(16) into some glyphs for display, and matched those glyphs with suitable
>> Unicode codepoints. (Well, "suitable" if you also see a right-arrow and a
>> right pointing triangle; do you?)
>
>I did with the non-printing control character, but not with '\u25ba' !
> So I had to go through some contortions after some research to get my
>Win7 cmd.exe and PowerShell to display the desired prompt using
>'\u25ba' as the character with utf-8 encoding.  My new
>pythonstartup.py file (Which PYTHONSTARTUP now points to) follows:
>
>#!/usr/bin/env python3
>
>import os
>import sys
>
>os.system('chcp 65001')    # cmd.exe and PowerShell require the code
>page to be changed.
>sys.ps1 = '\u25ba '  # I remembered to add the additional space.

Looks good to me. (I'm not a Windows person; the _logic_ looks good to me!)

>Additionally, one must set the font for cmd.exe and PowerShell to
>"Lucida Console" or the above will not work.

You may find some other fonts also work if you don't like that one.

>> So: I would not rely on your stuff being presented nicely if you use 16 and
>> 26 because they are not printable to start with, and you just got lucky. If,
>> OTOH, you figure out some nice glyphs and their Unicode points, then many
>> environments will render them sensibly. Though, of course, not a pure ACII
>> terminal - those are rare these days though.
>
>So let's see if this copies and pastes into a plain text Gmail and is
>visible to "many environments":
>
>Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
>64 bit (AMD64)] on win32
>Type "help", "copyright", "credits" or "license" for more information.
>Active code page: 65001
>► print("Can everyone read the prompt?")
>Can everyone read the prompt?
>>
>It looks good to me in Gmail.  Any issues?  Angry users of pure ASCII
>terminals? ~(:>)

I see a right pointing triangle. In green:-) But my terminals are 
green-on-black.

Cheers,
Cameron Simpson <cs at zip.com.au>


More information about the Tutor mailing list