[IPython-User] pythonnet and IPython

Dave Hirschfeld novin01@gmail....
Tue Nov 6 11:28:05 CST 2012


John Burkhart <jfburkhart.reg <at> gmail.com> writes:

> 
> Hello,
> 
> I'm trying to use IPython with pythonnet.
> 
> I have the following .bat script:
> 
> 
>  <at> echo off
> set path="C:\pythonnet\";%path%
> set PYTHONPATH="C:\Python27\Lib;C:\Python27\Lib\site-
packages;C:\pythonnet\";%pythonpath%
> python.exe -c "import sys; from IPython.frontend.terminal.ipapp import 
launch_new_instance; sys.exit(launch_new_instance())" %*
> exit /B %ERRORLEVEL%
> 
> 
> This worked previously on a VM machine running Windows 7, but now I've 
installed it on my actual laptop running Windows 7 and I get the traceback 
pasted below.
> 


I haven't tried to use the pythonnet executable `python.exe` but I've 
successfully compiled pythonnet with VS2010 targeting .NET4 & Python27.
After copying the resulting clr.pyd, Python.Runtime.dll.config and
Python.Runtime.dll to my Python27 (sys.prefix) directory I can then
import the clr as well as custom .NET4 dlls.

In [1]: import clr

In [2]: import System

In [3]: d = System.DateTime.Now

In [4]: d
Out[4]: <System.DateTime at 0x7fb02b0>

In [5]: print d
06/11/2012 17:27:43

In [6]: print d.AddDays(1)
07/11/2012 17:27:43

In [7]: 

HTH,
Dave



More information about the IPython-User mailing list