Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'interpreter': 0.05; 'continuation': 0.07; 'subject:code': 0.07; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'redo': 0.16; 'subject:program': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '(but': 0.19; 'command': 0.22; 'cc:addr:python.org': 0.22; 'commands,': 0.24; 'script.': 0.24; 'environment': 0.24; 'cc:2**0': 0.24; 'first,': 0.26; 'switch': 0.26; 'task': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'end,': 0.31; 'jean': 0.31; 'run': 0.32; 'running': 0.33; 'something': 0.35; 'received:google.com': 0.35; 'possible': 0.36; 'wrong': 0.37; 'pm,': 0.38; 'does': 0.39; 'itself': 0.39; 'manually': 0.60; "you're": 0.61; 'further': 0.61; 'to:addr:gmail.com': 0.65; 'line,': 0.68; 'console,': 0.84; 'copy-paste': 0.84; 'experiment': 0.84; 'subject:commands': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=k4XIb8UKvjV2VgZZYxv6iR9LmHwceiCcoroQnCGPMbY=; b=i08NgFRFmCmulL11Hdqb8QUz0JHRM/iLbfWV6hl8ZihC1F3pDsoLY6AbrWIn37LXaj 2nutkmrSEuh5DmQjU7TqkT9mVghV4sadxNNDQGDtXBSCkHhU1hZ6gUu9mrAJ+KoFTesV DAA22hzs5mb/oQFSSV7W+/9iXreKS6UGrz0qv2LI++j9w7YrKk27J2/6NKqzqFw/7Ljz F0A+CURGTwJSRiU+76LIYeYNhvhG3leudgEbbHN+IiEjm9hXRoxnrm2f1V7teFmDQven p1rBUYS6UA/rdlYKxDIwCgSb27egAWIUq84/eKk/bFC2qe0lek9hxUuTtBOgDPxsJm4e I9eQ== MIME-Version: 1.0 X-Received: by 10.66.141.165 with SMTP id rp5mr36298400pab.90.1387398485636; Wed, 18 Dec 2013 12:28:05 -0800 (PST) In-Reply-To: <7fb59330-6de2-4ea9-923e-7845de22df1e@googlegroups.com> References: <7fb59330-6de2-4ea9-923e-7845de22df1e@googlegroups.com> Date: Wed, 18 Dec 2013 15:28:05 -0500 Subject: Re: how to develop code using a mix of an existing python-program and console-commands From: Jerry Hill To: Jean Dubois Content-Type: text/plain; charset=UTF-8 Cc: "python-list \(General\)" 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387398496 news.xs4all.nl 2844 [2001:888:2000:d::a6]:43594 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62339 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. -- Jerry