<div dir="ltr">I get the same problem.<br><br>Another symptom is that "import System" fails if you don't AddReference first. never needed to do that for IPy 1.1 and don't need to either when running ipy 2.0.<br>
<br>It fails with my hosting code, and also reproduces with the "hello world" hosting sample:<br><a href="http://blogs.msdn.com/seshadripv/archive/2008/09/11/dlr-hosting-sample-simple-dlr-host-using-the-new-app-config-based-scriptruntime-creation.aspx">http://blogs.msdn.com/seshadripv/archive/2008/09/11/dlr-hosting-sample-simple-dlr-host-using-the-new-app-config-based-scriptruntime-creation.aspx</a><br>
<br>The only changes I made to the sample were<br>1) delete ruby configuration from App.config and the line of code that builds a ruby engine (I don't have the assemblies for ruby)<br>2) change the line defining the source code to:<br>
ScriptSource source = pyEng.CreateScriptSourceFromString(@"import System", SourceCodeKind.Statements);<br>3) remove the code that gets the "output" variable from pyEng (since we don't produce it)<br>
<br>like I said, this fails with "No module named System".<br>If you add a clr.AddReference("System"), then import works, but dir() seems to only show namespaces and not types, so import System.DateTime will fail.<br>
<br>I'm now looking at sources for IronPythonConsole to see what the difference is, but if someone knows what I'm doing wrong, please tell...<br><br>thanks<br>Ronnie<br><br><div class="gmail_quote">On Sun, Sep 21, 2008 at 8:31 AM, Serge R <span dir="ltr"><<a href="mailto:deus.verus@gmail.com">deus.verus@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I am migrating from 1.1 and have been unable to import System.Math class. I took a look at what's actually been imported<br>
<br>clr.AddReference("System")<br>import System<br>print dir(System)<br><br>On IP2 I got a small list that didn't contain Math or many other classes. Am I referencing something wrong?<br>
<br>IP2 List:<br>['CodeDom', 'Collections', 'ComponentModel', 'Configuration', 'Diagnostics', 'FileStyleUriParser', 'FtpStyleUriParser', 'GenericUriParser', 'GenericUriParserOptions', 'GopherStyleUriParser', 'HttpStyleUriParser', 'IO', 'LdapStyleUriParser', 'Media', 'Net', 'NetPipeStyleUriParser', 'NetTcpStyleUriParser', 'NewsStyleUriParser', 'Runtime', 'Security', 'Text', 'Threading', 'Timers', 'Uri', 'UriBuilder', 'UriComponents', 'UriFormat', 'UriFormatException', 'UriHostNameType', 'UriIdnScope', 'UriKind', 'UriParser', 'UriPartial', 'UriTypeConverter', 'Web']<br>
<br>IP1 List:<br>['AccessViolationException', 'Action', 'ActivationContext', 'Activator', 'AppDomain', 'AppDomainInitializer', 'AppDomainManager', 'AppDomainManagerInitializationOptions', 'AppDomainSetup', 'AppDomainUnloadedException', 'ApplicationException', 'ApplicationId', 'ApplicationIdentity', 'ArgIterator', 'ArgumentException', 'ArgumentNullException', 'ArgumentOutOfRangeException', 'ArithmeticException', 'Array', 'ArraySegment', 'ArrayTypeMismatchException', 'AssemblyLoadEventArgs', 'AssemblyLoadEventHandler', 'AsyncCallback', 'Attribute', 'AttributeTargets', 'AttributeUsageAttribute', 'BadImageFormatException', 'Base64FormattingOptions', 'BitConverter', 'Boolean', 'Buffer', 'Byte', 'CLSCompliantAttribute', 'CannotUnloadAppDomainException', 'Char', 'CharEnumerator', 'CodeDom', 'Collections', 'Comparison', 'ComponentModel', 'Configuration', 'Console', 'ConsoleCancelEventArgs', 'ConsoleCancelEventHandler', 'ConsoleColor', 'ConsoleKey', 'ConsoleKeyInfo', 'ConsoleModifiers', 'ConsoleSpecialKey', 'ContextBoundObject', 'ContextMarshalException', 'ContextStaticAttribute', 'Convert', 'Converter', 'CrossAppDomainDelegate', 'DBNull', 'DataMisalignedException', 'DateTime', 'DateTimeKind', 'DateTimeOffset', 'DayOfWeek', 'Decimal', 'Delegate', 'Deployment', 'Diagnostics', 'DivideByZeroException', 'DllNotFoundException', 'Double', 'DuplicateWaitObjectException', 'EntryPointNotFoundException', 'Enum', 'Environment', 'EnvironmentVariableTarget', 'EventArgs', 'EventHandler', 'Exception', 'ExecutionEngineException', 'FieldAccessException', 'FileStyleUriParser', 'FlagsAttribute', 'FormatException', 'FtpStyleUriParser', 'GC', 'GCCollectionMode', 'GenericUriParser', 'GenericUriParserOptions', 'Globalization', 'GopherStyleUriParser', 'Guid', 'HttpStyleUriParser', 'IAppDomainSetup', 'IAsyncResult', 'ICloneable', 'IComparable', 'IConvertible', 'ICustomFormatter', 'IDisposable', 'IEquatable', 'IFormatProvider', 'IFormattable', 'IO', 'IServiceProvider', 'IndexOutOfRangeException', 'InsufficientMemoryException', 'Int16', 'Int32', 'Int64', 'IntPtr', 'InvalidCastException', 'InvalidOperationException', 'InvalidProgramException', 'LdapStyleUriParser', 'LoaderOptimization', 'LoaderOptimizationAttribute', 'LocalDataStoreSlot', 'MTAThreadAttribute', 'MarshalByRefObject', 'Math', 'Media', 'MemberAccessException', 'MethodAccessException', 'MidpointRounding', 'MissingFieldException', 'MissingMemberException', 'MissingMethodException', 'ModuleHandle', 'MulticastDelegate', 'MulticastNotSupportedException', 'Net', 'NetPipeStyleUriParser', 'NetTcpStyleUriParser', 'NewsStyleUriParser', 'NonSerializedAttribute', 'NotFiniteNumberException', 'NotImplementedException', 'NotSupportedException', 'NullReferenceException', 'Nullable', 'Object', 'ObjectDisposedException', 'ObsoleteAttribute', 'OperatingSystem', 'OperationCanceledException', 'OutOfMemoryException', 'OverflowException', 'ParamArrayAttribute', 'PlatformID', 'PlatformNotSupportedException', 'Predicate', 'Random', 'RankException', 'Reflection', 'ResolveEventArgs', 'ResolveEventHandler', 'Resources', 'Runtime', 'RuntimeArgumentHandle', 'RuntimeFieldHandle', 'RuntimeMethodHandle', 'RuntimeTypeHandle', 'SByte', 'STAThreadAttribute', 'Security', 'SerializableAttribute', 'Single', 'StackOverflowException', 'String', 'StringComparer', 'StringComparison', 'StringSplitOptions', 'SystemException', 'Text', 'ThreadStaticAttribute', 'Threading', 'TimeSpan', 'TimeZone', 'TimeoutException', 'Timers', 'Type', 'TypeCode', 'TypeInitializationException', 'TypeLoadException', 'TypeUnloadedException', 'TypedReference', 'UInt16', 'UInt32', 'UInt64', 'UIntPtr', 'UnauthorizedAccessException', 'UnhandledExceptionEventArgs', 'UnhandledExceptionEventHandler', 'Uri', 'UriBuilder', 'UriComponents', 'UriFormat', 'UriFormatException', 'UriHostNameType', 'UriIdnScope', 'UriKind', 'UriParser', 'UriPartial', 'UriTypeConverter', 'ValueType', 'Version', 'Void', 'WeakReference', 'Web', '_AppDomain', '__builtins__', '__dict__', '__name__']<br>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br></div>