Created
December 9, 2014 18:10
-
-
Save ironpythonbot/6774d8e863c4ed6bd78e to your computer and use it in GitHub Desktop.
CodePlex Issue #34602 Plain Text Attachments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace IPyImports | |
{ | |
using IronPython.Hosting; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var e = Python.CreateEngine(); | |
var source = e.CreateScriptSourceFromString(string.Empty); | |
var result = source.Execute(); // no exceptions | |
var scope = e.CreateScope(); | |
source = e.CreateScriptSourceFromString(@"from System import Guid"); | |
result = source.Execute(scope); // serveral Exceptions: ImportException and TargetInvocationException | |
source = e.CreateScriptSourceFromString(@"from System import Guid"); | |
result = source.Execute(scope); // no exceptions | |
source = e.CreateScriptSourceFromString(@"from System import DateTime"); | |
result = source.Execute(); // no exceptions | |
source = e.CreateScriptSourceFromString(@"from System.Text import UTF8Encoding"); | |
result = source.Execute(); // no exceptions | |
source = e.CreateScriptSourceFromString(@"from System.Text import UTF8Encoding | |
import sys | |
from System.Threading import Thread"); | |
result = source.Execute(); // no exceptions | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment