[IronPython] Sharing state between embedded PythonEngines

JoeSox joesox at gmail.com
Wed Apr 11 22:05:00 CEST 2007


On 4/11/07, Chris Stoy <chris.stoy at redstorm.com> wrote:
> So, am I just thinking about this wrong?  How are people embedding
> IronPython in their apps?

I believe it really depends upon the application's objectives.  From
just being onlist for awhile it seems to me most developers are
creating something that is working behind the scene of the app itself.
 It also sounds to me that people place IronPython in a .Net app so
the user just uses .py files for the actual day-to-day work, sort of a
best of both worlds solution.

I originally got interested in IronPython much the same way.  I am not
sure if you have taken a look at a 'console' I have thrown out there.
I original created it to help me turn Python modules into IP friendly
ones.
http://www.codeproject.com/useritems/irontextbox.asp

I am not too happy with how it stands right now but it is very easy to
place in a .Net app and you can have several.  It is very easy to
customize to your liking.  I have been looking at a redesign making it
very similar to the VS IronPython console window. I was hoping to make
some hooks into the VS dlls but it is very complicated and it looks to
me that I would need to make a bunch of custom classes, which
unfortunately, I don't have the time to due right now.  If no one
beats me to it I might have something in 6 months or so. I also have
to design it so it doesn't depend upon VS dlls, incase the user
doesn't have them, or not, I haven't decided yet.

> It seems strange (and inefficient) to have to
> create a new PythonEngine and add all the references and expose globals
> every time I want to execute script.  Is there a way to share some of this
> state?  Can this be done using EngineModules?

Not knowing the exact details of your app and why you would need to
send messages to multiple consoles, it sounds like you would need to
develop your own classes to handle the messaging.  From what I have
derived from all of IP's console classes, this is not a built in
feature but I could be very much mistaken.  I do believe it can be
done, just that you would have to develop your own classes to handle
your objective and I bet there is at least two different ways you can
design them.
-- 
Later, JoeSox



More information about the Ironpython-users mailing list