Hello everyone,<br><br>I am relatively new to Python.NET, and I think that it will serve me very well for the application that I am developing. <br><br>I am taking an application that had previously been implemented using Python/wxPython/matplotlib/numpy/scipy, and reimplementing it using .NET 4. The main reason that I&#39;m doing this is because the application used to be used primarily by technical people comfortable to working in a Linux environment, but I am interested in making it usable by the Windows crowd.<br>
<br>On the other hand, I don&#39;t want to give up the ability to script the application with Python, and I don&#39;t want to give up using matplotlib/numpy/scipy. This is what has led me to Python.NET.<br><br>Following the email trail, I have been able to get the Console test program running using VS2010 targeting .NET 4. What I&#39;m now interested in doing is to get IPython to load automatically, so the user does not have to manually import IPython then call the IPShell mainloop. I am using Python 2.6.6, IPython 0.10.1, pyreadline 1.6.2 all on XP SP3 win32.<br>
<br>So I modified pythonconsole.py like this:<br><br>    [STAThread]<br>    public static int Main(string[] args) {<br>        string [] cmd = Environment.GetCommandLineArgs();<br>        PythonEngine.Initialize();<br><br>
        PyObject ip = PythonEngine.ImportModule(&quot;IPython&quot;);    &lt;&lt;&lt;&lt;&lt;&lt; new<br><br>        int i = Runtime.Py_Main(cmd.Length, cmd);<br>        PythonEngine.Shutdown();<br><br>        return i;<br>
    }<br><br>Unfortunately, ImportModule returns null.  Then, from the command line, if I manually import IPython, I get this<br><br>----<br>Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on<br>
win32<br>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>&gt;&gt;&gt; import IPython<br>Traceback (most recent call last):<br>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>
  File &quot;C:\Python26\lib\site-packages\IPython\__init__.py&quot;, line 58, in &lt;module&gt;<br><br>    __import__(name,glob,loc,[])<br>  File &quot;C:\Python26\lib\site-packages\IPython\Shell.py&quot;, line 37, in &lt;module&gt;<br>
    from IPython import ultraTB, ipapi<br>  File &quot;C:\Python26\lib\site-packages\IPython\ultraTB.py&quot;, line 93, in &lt;module&gt;<br>    from IPython import Debugger, PyColorize, ipapi<br>  File &quot;C:\Python26\lib\site-packages\IPython\Debugger.py&quot;, line 34, in &lt;module&gt;<br>
<br>    from IPython import PyColorize, ColorANSI, ipapi<br>ImportError: cannot import name PyColorize<br>----<br><br>On the other hand, if I leave out this ImportModule from pythonconsole.py, and manually import IPython from the command line, it imports successfully, and furthermore I can run the IPython mainloop.<br>
<br>Ultimately, what I really want to accomplish is to get my .NET 4 application to present the user with an IPython shell that has a .NET &quot;Application&quot; object injected into its namespace, so the user can start interacting with the .NET objects from the application, but also be able to do matplotlib type stuff too.<br>
<br>Does anyone have any thoughts as to why I&#39;m having problems importing IPython programmatically?<br><br>Thanks,<br>-Frank.<br><br><br><div style="visibility: hidden; left: -5000px; position: absolute; z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 130%;" id="avg_ls_inline_popup">
</div>