[IronPython] Are two PythonEngine instances connected?
Ive created two PythonEngine instances and set the Stdout for each instance to its own custom stream class (PythonStream) to capture the output. This stream class takes a delegate to specify the function to receive the response. class Tester { public void Test() { PythonEngine pythonEngine1 = new PythonEngine(); pythonEngine1.SetStdout(new PythonStream(ResponsePythonEngine1)); Console.WriteLine(pythonEngine1.Execute(\'p1'\) - ); pythonEngine1.Execute('p1'); Console.WriteLine(); PythonEngine pythonEngine2 = new PythonEngine(); pythonEngine2.SetStdout(new PythonStream(ResponsePythonEngine2)); Console.WriteLine(pythonEngine2.Execute(\'p2'\) - ); pythonEngine2.Execute('p2'); Console.WriteLine(); Console.WriteLine(pythonEngine1.Execute(\'p1'\) - ); pythonEngine1.Execute('p1'); Console.WriteLine(); Console.ReadLine(); } void ResponsePythonEngine1(string text) { if (!string.IsNullOrEmpty(text.Trim())) { Console.WriteLine( ResponsePythonEngine1 - + text); } } void ResponsePythonEngine2(string text) { if (!string.IsNullOrEmpty(text.Trim())) { Console.WriteLine( ResponsePythonEngine2 - + text); } } } After pythonEngine2 is created I receive the responses from commands executed on pythonEngine1 on the output of pythonEngine2. pythonEngine1.Execute('p1') - ResponsePythonEngine1 - 'p1' pythonEngine2.Execute('p2') - ResponsePythonEngine2 - 'p2' pythonEngine1.Execute('p1') - ResponsePythonEngine2 - 'p1' You can find my test application here: http://users.telenet.be/kristof.wagemans/PythonEngineConnected.zip ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] MapPoint COM object?
Hi,I am trying to manipulate mappoint from an IronPython script. I tried to do the COM integration I found in the Tutorial, but it failed. I have copied what I did into this email. Can someone take a look and tell me what I should have done? Thanks!- GardnerC:\Program Files\Microsoft MapPointtlbimp mpna82.tlbMicrosoft (R) .NET Framework Type Library to Assembly Converter 2.0.50727.42Copyright (C) Microsoft Corporation. All rights reserved. Type library imported to MapPoint.dllC:\Program Files\Microsoft MapPoint\IronPython\IronPythonConsoleIronPython 1.0.2280 (Beta) on .NET 2.0.50727.42Copyright (c) Microsoft Corporation. All rights reserved. import clr clr.AddReferenceToFile('MapPoint.dll')Traceback (most recent call last): File , line 0, in input##5 File , line 0, in AddReferenceToFile##6RuntimeError: Could not add reference to assembly MapPoint.dll ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com