4

In the python 2.7 console, as well as iPython 4, I was able to paste this string into a variable like so:

In [2]: c = 'ÙjÌÉñõµÏ“JÖq´ž#»&•¼²nËòQZ<_'

Subsequently I could type:

In [3]: print(c) and it would return ÙjÌÉñõµ Ï“JÖq´ž#»&•¼²nËòQZ<_

However, in iPython 5.0, I get the following error:

In [4]: c = 'ÙjÌÉñõµ^LÏ“JÖq´ž#»&•¼²nËòQZ<_'
  File "<ipython-input-4-9bf9f2fa5210>", line 1
    c = 'ÙjÌÉñõµ

^
SyntaxError: EOL while scanning string literal

Even %paste returns an error:

    ÙjÌÉñõµ
    ^
SyntaxError: invalid syntax

What changed in iPython from 4 to 5, and why is this occurring? Something to do with the string not having escaped quotes?

4
  • Changing the ^L to \^L makes it accept it, but that sequence is missing from c. It's as though the new readline code is interpreting the ^L as a control character. It shouldn't. Commented Jul 12, 2016 at 5:55
  • What's the source of this string? How many characters? What's it supposed to represent? Commented Jul 12, 2016 at 12:37
  • 32 characters. It's the ciphertext from DES encryption on a given plaintext and key and iv. Commented Jul 14, 2016 at 17:38
  • If I ctrl v that string on a plain python2.7 session and ask len(c) I get 46. And if I add u (unicode) to it, I get 27. Commented Jul 14, 2016 at 18:02

1 Answer 1

1

http://blog.jupyter.org/2016/07/08/ipython-5-0-released/

Ipython5 replaced the default readline with a new prompt_toolkit.

It looks like your string has several characters that the old readline ignored, but the new one sees. The first occurs right after the µ. I don't see it in the SO windows, but I can 'feel it' when moving the cursor over the line. I can also see something when pasting the line into an editor. But I not familiar enough with raw text tools to see more.

When I paste your string into a plain Python shell I get a bell and the screen clears. So even the regular readline is having problems with this string.

I've added '|' were there are unprintable characters

c = 'ÙjÌÉñõµ|Ï“JÖq´ž#|»&•¼|²nËòQZ<_'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.