[Python.NET] using Python.NET with .NET4/VS2010 in Python 2.7

Dave Hirschfeld dave.hirschfeld at gmail.com
Wed Aug 8 18:01:04 CEST 2012


Griffin, Brittany (AS <Brittany.Griffin at ...> writes:

> 
> 
> 
> Hi, 
> I’m trying to set up my pythonnet download to work with the .NET 4 framework.  
I’m new to this, so I might just be overlooking something. 
> 
> I’ve found many forums (currently using this one: 
> http://blog.bidiuk.com/2011/01/python-net-and-vs2010-net-4/ ) explaining the 
process to do this and have been successful in changing the cprojects to target 
.NET4, by using VS2010 express.  But, I cannot find the  buildclrmodule.bat file 
in my current
>  download in order to change it to reference .NET4 as well. Therefore, I 
currently get this error when trying to load a .NET4 assembly: 
> SystemError: dynamic module not initialized properly. I’ve gone back and 
looked through other downloads and have not come across the file.  Can anyone 
direct me to where I could get this file they are referencing, or how to fix 
this disconnection? 
>  
> Also, I am using Python 2.7.  My current Pythonnet download (pythonnet-2.0-
alpha2.zip) seems to only be programmed up to 2.6.  Any time I build the Runtime 
Assembly, it outputs a Python 2.5 Runtime.dll.  Any direction with this would be
>  very helpful!  
>  
> Thanks for your help!!
>  

Where are you getting your pythondotnet from?

I'd recommend checking out the latest source from subversion - you can see the 
file is there:

http://pythonnet.svn.sourceforge.net/viewvc/pythonnet/trunk/pythonnet/src/runtim
e/

If that's missing it sounds like you might not have an up to date version in 
which case I'd be careful of just cherry picking that file.

If you've got a subversion client installed you should be able to get the 
latest source by entering at the command line:

svn co https://pythonnet.svn.sourceforge.net/svnroot/pythonnet pythonnet 

If not http://www.sliksvn.com/en/download/ is a command line svn client,
or you can use tortoise - http://tortoisesvn.net/

In Visual Studio if you right-click the Python.Runtime project, choose 
properties then select the Build tab in the resulting dialog you'll see
under "Conditional compilation symbols" PYTHON25,UCS2 or similar. To target 
Python 2.7 simply change that to PYTHON27,UCS2

HTH,
Dave






More information about the PythonDotNet mailing list