Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.05; 'continuation': 0.07; 'subject:code': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'window.': 0.09; 'python': 0.11; 'jan': 0.12; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'redo': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'subject:program': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '(but': 0.19; 'command': 0.22; 'select': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'commands,': 0.24; 'script.': 0.24; 'environment': 0.24; 'first,': 0.26; 'switch': 0.26; 'task': 0.26; 'defined': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'code': 0.31; 'end,': 0.31; 'jean': 0.31; 'run': 0.32; 'running': 0.33; 'something': 0.35; 'editor': 0.35; 'there': 0.35; 'idle': 0.36; 'possible': 0.36; 'wrong': 0.37; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'does': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'manually': 0.60; 'received:173': 0.61; "you're": 0.61; 'further': 0.61; 'spot': 0.65; 'effectively': 0.66; 'line,': 0.68; 'click': 0.77; 'console,': 0.84; 'copy-paste': 0.84; 'experiment': 0.84; 'received:fios.verizon.net': 0.84; 'subject:commands': 0.84; 'hill': 0.95; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: how to develop code using a mix of an existing python-program and console-commands Date: Wed, 18 Dec 2013 17:02:46 -0500 References: <7fb59330-6de2-4ea9-923e-7845de22df1e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387404183 news.xs4all.nl 2880 [2001:888:2000:d::a6]:38589 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62343 On 12/18/2013 3:28 PM, Jerry Hill wrote: > On Wed, Dec 18, 2013 at 3:17 PM, Jean Dubois wrote: >> I have a python-program which I want to perform its task first, then >> switch to >> the python console to experiment with further commands, using what was >> already >> defined in the python-program. >> I want this as an alternative for what I do now (but which is not very >> efficient): >> I start the python-console and then manually copy-paste line per line from >> the program in the console, then try out possible continuation commands, >> if however something goes wrong I have to redo the whole process. > > On the command line, python itself can take command line options, > including one that does exactly what you're looking for. > > python -i script.py > > That command will run script.py to its end, then drop you into the > interactive interpreter with the environment intact from running the > script. This is effectively what Idle does when you run code in an editor window. You can interactive with the result in the Shell window. If there is a traceback, right click on a line in the traceback and select 'goto' to go the the spot of the foul. -- Terry Jan Reedy