[IronPython] Assemblies loaded by default

Dino Viehland dinov at exchange.microsoft.com
Mon Feb 4 17:17:53 CET 2008


Just FYI but this change reflects a change to the underlying DLR hosting APIs.  Under the new hosting APIs the loaded assemblies and there namespaces are reflected through ScriptEnvironment.Globals ScriptScope (and the Python importer now looks there for things to import).  It used to be that we'd always load those 2 assemblies but we no longer load any to give the host precise control over what assemblies they inject.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher
Sent: Monday, February 04, 2008 6:47 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Assemblies loaded by default

Ah, excellent; this helped me to find the source file: src\IronPython\Hosting\PythonCommandLine.cs
It actually loads the assemblies for both "string" and "System.Diagnostics.Debug".

Thanks!
On Feb 3, 2008 11:41 PM, Srivatsn Narayanan <srivatsn at microsoft.com<mailto:srivatsn at microsoft.com>> wrote:
I think this is all the IronPython interepreter loads:


ScriptDomainManager.CurrentManager.LoadAssembly(
typeof(string).Assembly); //mscorlib.dll

ScriptDomainManager.CurrentManager.LoadAssembly(
typeof(System.Diagnostics.Debug).Assembly); //System.dll


Srivatsn



________________________________
From: users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com> [users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com>] On Behalf Of Curt Hagenlocher [curt at hagenlocher.org<mailto:curt at hagenlocher.org>]
Sent: Sunday, February 03, 2008 9:38 PM
To: Discussion of IronPython
Subject: [IronPython] Assemblies loaded by default
When I run IronPython interactively, I automatically get System.dll loaded:

PS f:\IronPython-2.0A8> .\ipy.exe
IronPython 2.0 Alpha (2.0.0.800) on .NET 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import System
>>> System.DateTime
<type 'DateTime'>
>>>

But when I run an IronPython script through the hosting api, I don't:

C# source contains:
SourceUnit source = PythonEngine.CurrentEngine.CreateScriptSourceFromFile("Class1.py");
IScriptScope m = PythonEngine.CurrentEngine.CreateScope();
PythonEngine.CurrentEngine.Execute(m, source);

Class1.py contains:
import clr
import System
Output is:
IronPython.Runtime.Exceptions.ImportException : No module named System

What do I need to do to my embedding host to make sure it's preloading the same assemblies as the interactive console?

--
Curt Hagenlocher
curt at hagenlocher.org<mailto:curt at hagenlocher.org>

_______________________________________________
Users mailing list
Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080204/2e3bdfb1/attachment.html>


More information about the Ironpython-users mailing list