Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.ecp.fr!aioe.org!.POSTED!not-for-mail From: Mark H Harris Newsgroups: comp.lang.python Subject: Re: How to run script from interpreter? Date: Thu, 29 May 2014 15:26:37 -0500 Organization: Aioe.org NNTP Server Lines: 41 Message-ID: References: <6e96c4c4-17db-464b-b291-816c534b70c4@googlegroups.com> <5386a7e2$0$11109$c3e8da3@news.astraweb.com> NNTP-Posting-Host: eSF12mcVRIwL+eMIMJ03mA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.python:72251 On 5/28/14 10:22 PM, Steven D'Aprano wrote: >> If you want to use python as a shell-glue you can try using system. >> >> >>> from os import system >> >>> def ([parms]) >> >>> .... blah blah >> >>> .... rc = system(" > > os.system is cool for quick and dirty calls to an external command. But > for serious work, the subprocess module is better. > ... yup, particularly for non trivial network related stuff. Neither here nor there, but I just learned the ";" character command today for the Julia REPL, and got to thinking that python should have a similar way for the REPL to drop into "shell" mode for system commands. So, I might code a clear screen in python: def cls() rc = system("clear") or in Julia function cls() run(`clear`) end ... but on Julia we can also do this: ; clear On the Julia REPL the ";" character drops the julia prompt into shell. I think the IDLE REPL should have a system shell mode. What say you? marcus