Clearing the Python Console

Answered

I was shown that importing replit and using the clear() console works on other compilers (such as Repl). However, when I try this in Pycharm nothing happens.

import replit

replit.clear()

neither clears the console or gives an error.

The use case specifically calls for a cleared console, without the ability to scroll up (so repeating newlines will not work).

I am currently researching other ways to do this. But I am a bit surprised that a function that works just fine in other consoles won't work in Pycharm. Does anyone have a solution?

I'm trying to use keymap and pyautogui right now but it's not intuitive or working as yet.

Thanks in advance.

1 comment
Comment actions Permalink

It seems to be a bug. I filed a ticket to our issue tracker about that https://youtrack.jetbrains.com/issue/PY-48641, feel free to vote for it and comment.

Instead, you can use PyCharm's feature for clearing the console. Right-click inside the output area and choose Clear All:

I'm sorry for the inconvenience.

0

Please sign in to leave a comment.