System.Threading is actually in mscorlib, so you'd have to AddReference("mscorlib") as well. Alternatively, you can load both mscorlib and System.dll in your hosting code by saying something like this:<br><br>
ScriptDomainManager.CurrentManager.LoadAssembly(typeof(string).Assembly); //mscorlib.dll<br>ScriptDomainManager.CurrentManager.LoadAssembly(typeof(System.Diagnostics.Debug).Assembly); //System.dll<br><br>I think we've changed this in 2.6A1 so that these are always loaded by default in hosting scenarios.<br>
<br><div class="gmail_quote">On Wed, May 6, 2009 at 8:51 PM, Douglas Blank <span dir="ltr"><<a href="mailto:dblank@brynmawr.edu">dblank@brynmawr.edu</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'm working on a couple of variations of an IronPython Shell, and I have<br>
the following issue. When I import some DLLs interactively, I'm not seeing<br>
all of the available objects. For example, in my shells I try:<br>
<br>
>>> import clr<br>
>>> clr.AddReference("System")<br>
>>> from System.Threading import Thread<br>
<br>
and I get the error that 'Cannot import name Thread'. In fact, if I:<br>
<br>
>>> import System.Threading<br>
>>> dir(System.Threading)<br>
<br>
I get:<br>
<br>
['Semaphore', 'SemaphoreFullException', 'ThreadExceptionEventArgs',<br>
'ThreadExceptionEventHandler']<br>
<br>
However, using the ipy.exe console, I correctly get:<br>
<br>
>>> import System.Threading<br>
>>> dir(System.Threading)<br>
['AbandonedMutexException', 'ApartmentState', 'AsyncFlowControl',<br>
'AutoResetEvent', 'CompressedStack', 'ContextCallback', 'EventResetMode',<br>
'EventWaitHandle', 'ExecutionContext', 'HostExecutionContext',<br>
'HostExecutionContextManager', 'IOCompletionCallback', 'Interlocked',<br>
'LockCookie', 'ManualResetEvent', 'Monitor', 'Mutex', 'NativeOverlapped',<br>
'Overlapped', 'ParameterizedThreadStart', 'ReaderWriterLock',<br>
'RegisteredWaitHandle', 'Semaphore', 'SemaphoreFullException', 'SendOrP<br>
ostCallback', 'SynchronizationContext', 'SynchronizationLockException',<br>
'Thread', 'ThreadAbortException', 'ThreadExceptionEventArgs',<br>
'ThreadExceptionEventHandler', 'ThreadInterruptedException', 'ThreadPool',<br>
'ThreadPriority', 'ThreadStart', 'ThreadStartException', 'ThreadState',<br>
'ThreadStateException', 'Timeout', 'Timer', 'TimerCallback',<br>
'WaitCallback', 'WaitHandle', 'WaitHandleCannotBeOpenedException',<br>
'WaitOrTimerCallback']<br>
<br>
I feel I must be doing something fundamentally wrong... anyone have a<br>
guess as to what that might be? Thanks for any ideas!<br>
<br>
-Doug<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>
</blockquote></div><br>