switch to interactive mode

Discussion in 'Python' started by nntpman68, Mar 16, 2009.

  1. nntpman68

    nntpman68 Guest

    Hi

    I know about two ways to enter python interactive mode

    1.) just start python

    2.) run python -i pythonscript.py

    What I am looking for is slightly different:

    I'd like, that a python script can be started by just calling it
    (clicking on it),


    but that the script can decide to enter interactive mode if certain
    conditions occur.

    Is this possible?
     
    nntpman68, Mar 16, 2009
    #1
    1. Advertising

  2. nntpman68

    JBW Guest

    On Mon, 16 Mar 2009 23:49:34 +0100, nntpman68 wrote:

    > I'd like, that a python script can be started by just calling it
    > (clicking on it),
    >
    > but that the script can decide to enter interactive mode if certain
    > conditions occur.
    >
    > Is this possible?


    Don't know about the clicky-clicky part, but I've used code.interact to
    do something similar.

    JBW
     
    JBW, Mar 16, 2009
    #2
    1. Advertising

  3. On Mar 16, 5:49 pm, nntpman68 <> wrote:
    > Hi
    >
    > I know about two ways to enter python interactive mode
    >
    > 1.) just start python
    >
    > 2.) run python -i pythonscript.py
    >
    > What I am looking for is slightly different:
    >
    > I'd like, that a python script can be started by just calling it
    > (clicking on it),
    >
    > but that the script can decide to enter interactive mode if certain
    > conditions occur.
    >
    > Is this possible?


    That sounds kind of like needing to embed the interpreter. I would
    recommend looking into that. Wingware's Wing IDE has this feature
    where you can run the program up a breakpoint and then use their
    debugger to interact with the variables and objects and such.

    Mike
     
    Mike Driscoll, Mar 16, 2009
    #3
  4. nntpman68

    nntpman68 Guest

    Hi JBW.


    code.interact() does what I wanted. Great !!!


    Thanks



    N

    JBW wrote:
    > On Mon, 16 Mar 2009 23:49:34 +0100, nntpman68 wrote:
    >
    >> I'd like, that a python script can be started by just calling it
    >> (clicking on it),
    >>
    >> but that the script can decide to enter interactive mode if certain
    >> conditions occur.
    >>
    >> Is this possible?

    >
    > Don't know about the clicky-clicky part, but I've used code.interact to
    > do something similar.
    >
    > JBW
    >
     
    nntpman68, Mar 16, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    1
    Views:
    320
    Peter Hansen
    Sep 9, 2005
  2. John J Lee
    Replies:
    3
    Views:
    491
    bruno at modulix
    Dec 1, 2005
  3. Edward Loper
    Replies:
    0
    Views:
    477
    Edward Loper
    Aug 7, 2007
  4. John J Lee
    Replies:
    0
    Views:
    530
    John J Lee
    Aug 7, 2007
  5. Replies:
    2
    Views:
    95
    Tom Cole
    Aug 24, 2006
Loading...

Share This Page