This was from
http://www.ironpython.info/index.php/Simulating_thread.interrupt_main

The code below is supposed to simulate thread.interrupt, but it seems like
Microsoft.Scripting.Shell is not there any more...

import clr
> clr.AddReference('Microsoft.Scripting')
> from Microsoft.Scripting.Shell import KeyboardInterruptException
> from System import Threading
>
> main = Thread.CurrentThread
>
> main.Abort(KeyboardInterruptException(""))
>

Here is a dump from ipy console:

 >>> clr.AddReference('Microsoft.Scripting')
> >>> import Microsoft.Scripting
> >>> dir(Microsoft.Scripting)
> ['ArgumentTypeException', 'AssemblyLoadedEventArgs', 'CompilerOptions',
> 'ErrorCo
> unter', 'ErrorSink', 'Generation', 'Hosting', 'IScopeVariable',
> 'IndexSpan', 'In
> validImplementationException', 'LanguageOptions',
> 'ParamDictionaryAttribute', 'P
> latformAdaptationLayer', 'Runtime', 'ScopeStorage', 'ScopeVariable',
> 'ScopeVaria
> bleIgnoreCase', 'ScriptCode', 'ScriptCodeParseResult', 'Severity',
> 'SourceCodeKi
> nd', 'SourceCodePropertiesUtils', 'SourceCodeReader', 'SourceLocation',
> 'SourceS
> pan', 'SourceUnit', 'StreamContentProvider', 'SyntaxErrorException',
> 'TextConten
> tProvider', 'TokenCategory', 'TokenInfo', 'TokenKind', 'TokenTriggers',
> 'Utils']
>

Can someone verify that this is the case?

Or is there a way to raise an exception to the main thread using threading
module?
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to