简体   繁体   中英

PyCharm Your Terminal Doesn't Support Cursor Position Requests (CPR)

I have the following python code I'm testing out in PyCharm Professional 2021.1.2:

from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.completion import WordCompleter
import os

CmdCompleter = WordCompleter(['hello', 'goodnight'])


while 1:
    user_input = prompt('>',
                        history=FileHistory(os.path.expanduser('~/.repl_history')),
                        auto_suggest=AutoSuggestFromHistory(),
                        completer=CmdCompleter)
    print(user_input)

PyCharm is running on my Windows host and is configured to use a remote SSH Interpreter on a Debian 10 VM. When I go to run the application, I get WARNING: your terminal doesn't support cursor position requests (CPR). within the PyCharm run window. Running the code natively in the Linux VM causes no issues. Is there any configuration, setting, or option I can change to get the output in the PyCharm run window to appear/work correctly?

When testing on PyCharm personally, I got an error:

prompt_toolkit.output.win32.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?

I don't know why you got a warning but I got an error, but in order to fix this, I just went to Configuration settings and checked Emulate terminal in output console :

编辑配置

在输出控制台中模拟终端

I hope that this fixes the problem!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM