Visual Studio Code / Cursor terminal cannot handle Python comment with special characters

21 hours ago 1
ARTICLE AD BOX

In a Python script there exists the following comment that shows the structure of an intermediate Polars data frame.

print('a') # ┌──────────┬──────┬────────┬─────────────────┬────────────────────┬────────┐ # │ aaaaaaaa ┆ bbb ┆ cccccc ┆ ddddddddddddddd ┆ eeeeeeeeeeeee ┆ ffffff │ # │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │ # │ i32 ┆ i32 ┆ i32 ┆ u32 ┆ list[i32] ┆ i64 │ # ╞══════════╪══════╪════════╪═════════════════╪════════════════════╪════════╡ # │ 4 ┆ 5911 ┆ 0 ┆ 61373 ┆ [0, 1, … 95944] ┆ 0 │ # │ 7 ┆ 5911 ┆ 0 ┆ 61373 ┆ [0, 1, … 95944] ┆ 1 │ # │ 7 ┆ 5711 ┆ 0 ┆ 58129 ┆ [0, 2, … 95943] ┆ 2 │ print('b')

For debugging purposes, I often select a block of code and send it (Shift+Enter or simple copy+paste) to Python terminal in Cursor and execute. This has been working fine until I updated Cursor version to the latest 2.6.20 . The issue already existed in a few versions earlier than 2.6.20 but previously I chose to rollback the updates.

Symptom: The Python terminal in Cursor will hang and die if I Shift+Enter or copy+paste the above code block into the terminal. Nothing goes wrong if I do this to a native terminal on my macbook.

AI says it's due to complex unicode box-drawing characters and gave a number of suggestions that ultimately didn't work.

I want to keep Cursor updates and Python comments like the above, while still have the freedom of fiddling code like I used to. Is there a valid solution? Thanks!

Python version: 3.13.7 or 3.14.3

Some new development: With Python 3.14.3, it somehow prompted the following error

Python 3.14.3 (v3.14.3:323c59a5e34, Feb 3 2026, 11:41:37) [Clang 16.0.0 (clang-1600.0.26.6)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/_pyrepl/readline.py", line 395, in multiline_input return reader.readline() ~~~~~~~~~~~~~~~^^ File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/_pyrepl/reader.py", line 758, in readline self.handle1() ~~~~~~~~~~~~^^ File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/_pyrepl/reader.py", line 741, in handle1 self.do_cmd(cmd) ~~~~~~~~~~~^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/_pyrepl/reader.py", line 666, in do_cmd command.do() ~~~~~~~~~~^^ File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/_pyrepl/commands.py", line 497, in do ev = self.reader.console.getpending() File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/_pyrepl/unix_console.py", line 544, in getpending e.data += e2.data TypeError: can only concatenate str (not "NoneType") to str

Again, this ONLY happens if I use Cursor's terminal. MacOS's native terminal is fine.

Read Entire Article