title: VISBRAIN in IronPython 2.7.8
body: <p>I am using Window 7, 64 bit.</p>
  
  <p>using Anaconda3.
  Anaconda3 is in my D.</p>
  
  <p>I am running a C# application in Visual Studio 2017 Community, trying to run Visbrain from ironpython.</p>
  
  <p>IronPython that I am using is IronPython version 2.7.8.</p>
  
  <p>I had included IronPython.Modules.dll, IronPython.dll, Microsoft.Scripting.dll, Microsoft.Dynamic.dll.</p>
  
  <p>my .net framework is 4.0.</p>
  
  <p>below is my code:</p>
  
  <pre><code>// create python engine
  var myPythonEngine = Python.CreateEngine();
  
  // create search path
  var searchPaths = myPythonEngine.GetSearchPaths();
  
  searchPaths.Add(@"D:\Anaconda3\envs\myenv3604\Lib"); // using anaconda 3
  //searchPaths.Add(@"D:\Python 35\Lib"); // python standard library
  
  searchPaths.Add(@"D:\Anaconda3\envs\myenv3604\lib\site-packages"); // using anaconda 3
  //searchPaths.Add(@"D:\Python 35\lib\site-packages"); // visbrain inside here
  
  // set search path
  myPythonEngine.SetSearchPaths(searchPaths);
  
  // create scope to execute python code and get backs results from python code
  var myScope = myPythonEngine.CreateScope();
  
  // create the source
  var mySource = myPythonEngine.CreateScriptSourceFromFile(@"test12345.py");
  
  // execute the scope
  mySource.Execute(myScope);
  </code></pre>
  
  <p>but after I run my code, it pops out.</p>
  
  <pre><code>IronPython.Runtime.Exceptions.ImportException: 'No module named visbrain'
  </code></pre>
  
  <p><strong>tried solution:</strong></p>
  
  <p>1) <a href="https://stackoverflow.com/questions/45737763/ironpython-runtime-exceptions-importexception-no-module-named-os">IronPython.Runtime.Exceptions.ImportException: No module named os</a></p>
  
  <p>I added the lib to my search path, but still no luck</p>
  
  <p><strong>Solution for 1) :</strong></p>
  
  <p>according to <a href="https://stackoverflow.com/questions/1765919/why-cant-i-import-my-c-sharp-type-into-ironpython">Why can&#39;t I import my C# type into IronPython?</a></p>
  
  <p>added</p>
  
  <pre><code>searchPaths.Add(@"D:\Python35\DLLs");
  searchPaths.Add(@"D:\Python35\lib\site-packages");
  </code></pre>
  
  <p>===</p>
  
  <p>but after I run again, it pops out this error:</p>
  
  <pre><code>Exception thrown: 'Microsoft.Scripting.SyntaxErrorException' in Microsoft.Dynamic.dll
  An unhandled exception of type 'Microsoft.Scripting.SyntaxErrorException' occurred in Microsoft.Dynamic.dll
  unexpected token 'exc_info'
  </code></pre>
  
  <p>stack trace is below:</p>
  
  <pre><code>Microsoft.Scripting.SyntaxErrorException
    HResult=0x80131500
    Message=unexpected token 'exc_info'
    Source=IronPython
    StackTrace:
     at IronPython.Runtime.ThrowingErrorSink.Add(SourceUnit sourceUnit, String message, SourceSpan span, Int32 errorCode, Severity severity)
     at IronPython.Compiler.Parser.ReportSyntaxError(Int32 start, Int32 end, String message, Int32 errorCode)
     at IronPython.Compiler.Parser.ReportSyntaxError(Token t, IndexSpan span, Int32 errorCode, Boolean allowIncomplete)
     at IronPython.Compiler.Parser.ParseVarArgsList(TokenKind terminator)
     at IronPython.Compiler.Parser.ParseFuncDef()
     at IronPython.Compiler.Parser.ParseSuite()
     at IronPython.Compiler.Parser.ParseClassOrFuncBody()
     at IronPython.Compiler.Parser.ParseClassDef()
     at IronPython.Compiler.Parser.ParseFileWorker(Boolean makeModule, Boolean returnValue)
     at IronPython.Compiler.Parser.ParseFile(Boolean makeModule, Boolean returnValue)
     at IronPython.Runtime.PythonContext.ParseAndBindAst(CompilerContext context)
     at IronPython.Runtime.PythonContext.CompilePythonCode(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink)
     at IronPython.Runtime.PythonContext.CompileModule(String fileName, String moduleName, SourceUnit sourceCode, ModuleOptions options, ScriptCode&amp; scriptCode)
     at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context, String name, String path)
     at IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String name, String fullName, String str)
     at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, List path, Func`5 defaultLoader)
     at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, List path)
     at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name)
     at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
     at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)
     at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
     at IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
     at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
     at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
     at IronPython.Runtime.PythonContext.InitializeModule(String fileName, ModuleContext moduleContext, ScriptCode scriptCode, ModuleOptions options)
     at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context, String name, String path)
     at IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String name, String fullName, String str)
     at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, List path, Func`5 defaultLoader)
     at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, List path)
     at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
     at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)
     at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.LightLambda.Run8[T0,T1,T2,T3,T4,T5,T6,T7,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
     at IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
     at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
     at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
     at IronPython.Runtime.PythonContext.InitializeModule(String fileName, ModuleContext moduleContext, ScriptCode scriptCode, ModuleOptions options)
     at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context, String name, String path)
     at IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String name, String fullName, String str)
     at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, List path, Func`5 defaultLoader)
     at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, List path)
     at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
     at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)
     at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.LightLambda.Run8[T0,T1,T2,T3,T4,T5,T6,T7,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
     at System.Dynamic.UpdateDelegates.UpdateAndExecute7[T0,T1,T2,T3,T4,T5,T6,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
     at IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
     at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
     at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
     at IronPython.Runtime.PythonContext.InitializeModule(String fileName, ModuleContext moduleContext, ScriptCode scriptCode, ModuleOptions options)
     at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context, String name, String path)
     at IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String name, String fullName, String str)
     at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, List path, Func`5 defaultLoader)
     at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, List path)
     at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name)
     at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
     at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)
     at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
     at IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
     at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
     at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
     at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
     at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
     at WindowsFormsAppJTTH.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\JamesTan\source\repos\WindowsFormsAppJTTH\WindowsFormsAppJTTH\Form1.cs:line 170
     at System.Windows.Forms.Control.OnClick(EventArgs e)
     at System.Windows.Forms.Button.OnClick(EventArgs e)
     at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
     at System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks)
     at System.Windows.Forms.Control.WndProc(Message&amp; m)
     at System.Windows.Forms.ButtonBase.WndProc(Message&amp; m)
     at System.Windows.Forms.Button.WndProc(Message&amp; m)
     at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
     at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg)
     at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
     at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
     at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
     at WindowsFormsAppJTTH.Program.Main() in C:\Users\JamesTan\source\repos\WindowsFormsAppJTTH\WindowsFormsAppJTTH\Program.cs:line 19
  </code></pre>
  
  <p>Would like to know is there any way to solve this?</p>