Sometimes when I run a python terminal application of mine, I get weird characters all over the place. See screenshot. This only happens once in ten times.

I haven't seen this happen in other terminals. What's going on?



It is a bug in your Python code. The characters are all Unicode 001B, U+001B is the escape character. Your terminal is rendering it as a box with 001B inside. Your Python program is printing escape characters to the terminal, which is interpreting them as Unicode characters. You can reproduce this easily:

$ python
Python 2.7.7rc1 (default, May 21 2014, 11:15:30) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print chr(0x001b)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.