[Python.NET] Using an existing Python installation

Mike Casaday meeper at innerverse.com
Tue Nov 4 16:55:10 EST 2003


Python for .NET is really cool!

Here's something I found out while trying to get it to work with my
existing Python 2.3 installation.

The README says:
> **Can I use it with my existing Python installation?**
>
> Yes, at least on win32 systems. Just copy the files
> Python.Runtime.dll and CLR.dll from the PythonNet directory to the
> root directory of your python installation.
>

This answer comes with one caveat in my experience.  For some reason
you have to 'import CLR' before trying to import anything else from
the .NET runtime.  This isn't the case if I use the Python executable
included in PythonNet-1.0-beta1.tgz, only if I use my existing Python
installation.

So this fails:

 from CLR.System.Reflection import Assembly
Assembly.LoadWithPartialName('SomeNamespace')
import CLR.SomeNamespace as SomeNamespace

But this works:

import CLR
 from CLR.System.Reflection import Assembly
Assembly.LoadWithPartialName('SomeNamespace')
import CLR.SomeNamespace as SomeNamespace

Is it possible I'm doing something wrong (more than likely)?  Is this
a bug?  Is this expected behavior?  ZODB requires you to 'import ZODB'
before you do certain things, so I wouldn't be surprised...

______________
mike

P.S. I'm now playing around with the TrueVision3D game engine using
Python, something that I couldn't really do until now.  I'm happy I
saw a link to this project from Daily Python-URL.





More information about the PythonDotNet mailing list