I think I follow you but I think I can be more specific in getting at what sems
to be a subtlety. If you have the following (a file e.g. Spam.py):
import clr
clr.AddReference("System")
from System.Text import *
s = StringBuilder()
print "okay"
It works just fine when executed from a command shell using ipy (ipy Spam.py).
The assumption is that mscorlib is loaded because of the
clr.AddReference("System").
But when using a hosted engine, mscorlib seems not to be loaded for free
anymore -
ScriptEngine engine = PythonEngine.CurrentEngine;
engine.Runtime.ExecuteFile("Spam.py")
Now the reference that came for "free" before to mscorlib seems not to be
present.
----- Original Message ----
From: Curt Hagenlocher <[EMAIL PROTECTED]>
To: Discussion of IronPython <users@lists.ironpython.com>
Sent: Thursday, April 17, 2008 10:39:49 PM
Subject: Re: [IronPython] DLR Hosting, Access to .NET Types
On Thu, Apr 17, 2008 at 8:33 PM, David Seruyange <[EMAIL PROTECTED]> wrote:
>
> Are all framework types accessible from a hosted engine? While the module
> loads fine using the above code, a reference to the StringBuilder (which
> works fine when executing a file that references the module) produces an
> error "name StringBuilder not defined." (The module does have a "from
> System.Text import *") -
The console does the equivalent of the following:
runtime.LoadAssembly(typeof(string).Assembly);
runtime.LoadAssembly(typeof(System.Diagnostics.Debug).Assembly);
You'll need to execute similar code if you want to access the same assemblies
--
Curt Hagenlocher
[EMAIL PROTECTED]
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com