How to pass calculated data to my own Python shell namespace at runtime ?

The Shell ctor takes a "locals" keyword argument, which is a
dictionary to use to as the namespace of the shell - modifications to
it will be visible from both "sides". One thing to be aware of is that
__builtins__ will be added to it.

Chris, it works at start-up of the shell, but when the shell is already running. So I would have to kill my shell and then re-open the shell each time my dictionnary of locals changes.... is there a way to update the namespace of locals without killing the shell ?

···

On 1/11/07, Robert F. VERGNES <rfv@lit-energy.com> wrote:

In my main frame, I have a tab , in the tab I have shell running:

        self.qmeshell = py.shell.Shell(self.nbls, -1,
introText="Qme-PythonShell ")
        self.nbls.AddPage(self.qmeshell,"Qme-Python Shell")

All is ok BUT

in some part of the program I calculate some matrix and I want to have
access to this matrix in the shell.

How to pass my matrix say 'matx' into the namespace of the shell running
in mind so that I can access my 'matx' from the shell ?

Then can I read from my shell namespace and get 'matx' back after I
played with it in the shell ? This inorder to send it back to my program ?

Any idea is welcome.

Best Regards

Robert

You can make all the changes to the dictionary that you want, they
will be reflected. If you need an entirely new locals dictionary, you
will need to re-create the shell.

···

On 1/12/07, Robert F. VERGNES <rfv@lit-energy.com> wrote:

On 1/11/07, Robert F. VERGNES <rfv@lit-energy.com> wrote:

In my main frame, I have a tab , in the tab I have shell running:

         self.qmeshell = py.shell.Shell(self.nbls, -1,
introText="Qme-PythonShell ")
         self.nbls.AddPage(self.qmeshell,"Qme-Python Shell")

All is ok BUT

in some part of the program I calculate some matrix and I want to have
access to this matrix in the shell.

How to pass my matrix say 'matx' into the namespace of the shell running
in mind so that I can access my 'matx' from the shell ?

Then can I read from my shell namespace and get 'matx' back after I
played with it in the shell ? This inorder to send it back to my program ?

Any idea is welcome.

Best Regards

Robert

The Shell ctor takes a "locals" keyword argument, which is a
dictionary to use to as the namespace of the shell - modifications to
it will be visible from both "sides". One thing to be aware of is that
__builtins__ will be added to it.

Chris, it works at start-up of the shell, but when the shell is already
running. So I would have to kill my shell and then re-open the shell each
time my dictionnary of locals changes.... is there a way to update the
namespace of locals without killing the shell ?