python-idle


How to clear Python Shell in IDLE [duplicate]


This question already has an answer here:
How to clear the interpreter console?
31 answers
I'm running a script that uses a module that prints a lot of things on screen and I'm running out of RAM.
I can't make the module not to write anything for now.
The Python Shell stores absolutely everything and I want to clear it.
On similar questions the only answer I could find was to write os.system('cls') (on Windows), but it doesn't delete anything.
Is there a way to clear the Python Shell or to limit its size?
Thanks
Edit.
Well, this question was marked as duplicate and I am asked to clarify why it isn't.
I state that os.system('cls') doesn't work, while the answer to the question I supoosedly duplicate is to write os.system('cls').
By python shell, do you mean IDLE? Some quick googling suggests that IDLE doesn't have a clear screen even though lots of people seem to want one. If it's in a shell, then I'm surprised 'cls' isn't working.
If you like working in Idle, you might look at this for getting the functionality you want:
http://idlex.sourceforge.net/extensions.html#ShellEnhancements
The internet seems to think you should just stop using IDLE, however.
How are you running the script? Are you calling it from a shell? If so, you can redirect all output to a file like this:
python my_script.py > /out/to/some/path.log
If the module is just printing, you can use this:
import sys
sys.stdout = open('/dev/null', 'a') # or a real file, if you care about output.

Related Links

How can I run Python on Idle?
Logo in python shell
How can I stop IDLE from auto indeting?
How to open as python file as .py instead of .pyw while trying to edit with IDLE
Python 2.7.11, 3.4.4, 3.5.1 IDLE Print Window function doesn't work
Get python idle to run in interactive mode without command line switch
IDLE background color in python
Can't use ibus-mozc ime with IDLE(python)
IDLE restarts when some of rpy2 modules are imported
How to refresh the python IDLE screen on Windows?
Ctrl+s does not always save a file on IDLE
In IDLE 3 python shell, how to use 'ls' command properly to get proper result
I have Python 3.3.2 installed, but cannot get Idle 3 to open
How to clear Python Shell in IDLE [duplicate]
IDLE for Python 3.3 doesn't start and does not give an error message
Is it possible to install IDLE on Python 2.5 and Ubuntu

Categories

HOME
arrays
sharepoint
vue.js
signalr
wxwidgets
concourse
codeeffects
is-empty
value
rebol
algorithmic-trading
websphere-liberty
dropbear
uiactivityviewcontroller
viber
multiple-monitors
mod-pagespeed
titan
redux-observable
flat-file
nsmenuitem
cocoa-touch
tarantool
qsub
fabric
data-cleansing
web-frontend
system.data.sqlite
superagent
pygooglechart
rowcount
entity-system
preg-grep
hawtio
node-horseman
honeysql
lego
haskell-pipes
s3cmd
onbackpressed
tango
crop
mod-fcgid
bids
startapp
automator
tableau-server
ruby-on-rails-2
heroku-postgres
opencpu
python-hypothesis
alter
spring-ioc
windows-azure-pack
asteriskami
ng2-material
emokit
project-online
inet
self-hosting
document-oriented-db
response-headers
anti-patterns
rx-groovy
gray-code
lines-of-code
pylearn
uos
scrollspy
sysfs
google-earth-plugin
jai
hana-xs
moai
docopt
suffix-array
aquafold
kraken.js
osx-snow-leopard
facebook-sdk-3.1
haskell-platform
localtime
client-side-scripting
awesomeprint
abnf
cbcentralmanager
web-safe-fonts
rose-db-object
easygui
port-scanning
graniteds
savestate
web-analytics-tools

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App