Author ned.deily
Recipients ned.deily, terry.reedy, twister68@gmail.com
Date 2019-12-30.07:14:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1577690088.24.0.94780846315.issue39141@roundup.psfhosted.org>
In-reply-to
Content
Unfortunately, this is not going to work as you expect because you are mixing commands for different windowing systems.  The OS-level 'clear' command is used to clear a normal terminal window by issuing special character sequences to standard output that are recognized by the terminal emulator, like for instance Terminal.app on macOS.  When you run commands using os.system() under IDLE on macOS, the standard output descriptor for the subprocess created by os.system is not handled by IDLE.  Currently open Issue11820 describes this problem.  You are apparently running IDLE.app (by launching the app from the Finder) and the command fails because standard output of the subprocess is not associated with a terminal window.  If, instead, you launched IDLE from a terminal window (in Terminal.app):

/usr/local/bin/idle3.8

and ran your test, you would see that the 'clear' clears the Terminal.app window, not the IDLE shell window (and now returns a status of 0), still not what you are looking for.

Even if Issue11820 is implemented such that the standard output from subprocesses are associated with the IDLE shell window, there would still be a problem in that the special character sequences sent by the 'clear' command would most likely not be recognized by the IDLE shell window or its underlying Tk widget, so using the OS 'clear' command still would not work.  A better solution is for IDLE to provide its own 'clear' command and that is the subject of open Issue6143, which this issue should probably be closed as a duplicate of.
History
Date User Action Args
2019-12-30 07:14:48ned.deilysetrecipients: + ned.deily, terry.reedy, twister68@gmail.com
2019-12-30 07:14:48ned.deilysetmessageid: <1577690088.24.0.94780846315.issue39141@roundup.psfhosted.org>
2019-12-30 07:14:48ned.deilylinkissue39141 messages
2019-12-30 07:14:47ned.deilycreate