R
RG
More precisely, why does sys.ps1 not appear if I set it to a unicode
string? This problem is hard for me to describe here because my
newsreader is not properly unicode enabled, but here's the gist of it:
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
First, let's make sure our encodings are set properly:
'utf-8'
Looks good. Now, let's make two unicode strings, identical except for
one character:
%%% /&%%%
If this were a properly unicode-enabled newsreader you would see a
yin-yang symbol in the middle of s2.
Now the weird part:
%%% %%% sys.ps1 = s2 # This is as expected
print s1 # But this isn't. There's no prompt!
%%% %%% # Everything still works
print s2
%%% /&%%%
sys.ps1 = s1 # If we reset sys.ps1 we get our prompt back
%%% %%% sys.ps1 = '>>> '
So... why does having a non-ascii character in sys.ps1 make the prompt
vanish?
(If you're wondering why I care, I want to connect to an interactive
python interpreter from another program, and I want a non-ascii
delimiter to unambiguously mark the end of the interpreter's output on
every interaction.)
Thanks,
rg
string? This problem is hard for me to describe here because my
newsreader is not properly unicode enabled, but here's the gist of it:
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
First, let's make sure our encodings are set properly:
'utf-8'
Looks good. Now, let's make two unicode strings, identical except for
one character:
%%% /&%%%
If this were a properly unicode-enabled newsreader you would see a
yin-yang symbol in the middle of s2.
Now the weird part:
%%% %%% sys.ps1 = s2 # This is as expected
print s1 # But this isn't. There's no prompt!
%%% %%% # Everything still works
print s2
%%% /&%%%
sys.ps1 = s1 # If we reset sys.ps1 we get our prompt back
%%% %%% sys.ps1 = '>>> '
So... why does having a non-ascii character in sys.ps1 make the prompt
vanish?
(If you're wondering why I care, I want to connect to an interactive
python interpreter from another program, and I want a non-ascii
delimiter to unambiguously mark the end of the interpreter's output on
every interaction.)
Thanks,
rg