[IronPython] Assemblies loaded by default

2008-02-03 Thread Curt Hagenlocher
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
[EMAIL PROTECTED]
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Assemblies loaded by default

2008-02-03 Thread Miha Valencic
Try import clr in your python script. I use Python 1.1 though..

Miha

On Feb 4, 2008 6:38 AM, Curt Hagenlocher [EMAIL PROTECTED] wrote:

 When I run IronPython interactively, I automatically get System.dllloaded:


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


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Assemblies loaded by default

2008-02-03 Thread Srivatsn Narayanan
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: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Curt Hagenlocher [EMAIL 
PROTECTED]
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
[EMAIL PROTECTED]mailto:[EMAIL PROTECTED]
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com