how to change a script while it is running

Discussion in 'Python' started by faxme, Jul 7, 2005.

  1. faxme

    faxme Guest

    Hi, I would like to know if it is possible to change code on the fly on a
    python interpreter. I want to have a python script running a multithread
    server and be able to connect to this python script and change the
    interpreter environment. Is this possible?
    Ideally i would like to call python, load the script inside the python
    command line and while the script works still be able to type other python
    commands(that might change the running script).

    Thanks
     
    faxme, Jul 7, 2005
    #1
    1. Advertising

  2. Hi !

    Try :


    def ff(a):
    print a*2

    ff(111)

    exec('''def ff(a):
    print a*3
    ''',globals(),globals())

    ff(111)



    @-salutations

    Michel Claveau
     
    Do Re Mi chel La Si Do, Jul 7, 2005
    #2
    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. Erik Moore
    Replies:
    0
    Views:
    349
    Erik Moore
    Feb 24, 2006
  2. forrest stanley

    Seg fault while running C script as non root

    forrest stanley, Jun 25, 2003, in forum: C Programming
    Replies:
    10
    Views:
    1,656
    Micah Cowan
    Jun 27, 2003
  3. Benjamin Rutt
    Replies:
    2
    Views:
    982
    Peter Hansen
    Dec 20, 2005
  4. yohan
    Replies:
    0
    Views:
    821
    yohan
    May 18, 2007
  5. Replies:
    2
    Views:
    169
    Sean O'Halpin
    Dec 17, 2008
Loading...

Share This Page