[Python.NET] RE: Problem whith DirectX Mesh importation

Brian Lloyd brian at zope.com
Thu Jan 22 10:02:55 EST 2004

> "from CLR.Microsoft.DirectX.Direct3D import Mesh"
> => ImportError: cannot import name Mesh
> It seems that 'Mesh' is define in the Direct3DX library because when I
> remove the reference the "Microsoft.DirectX.Direct3DX" in the 
> reference list
> in a directx C# sample, I have the same error...
> How can I add a refrence like in C# ?
> The "import CLR.Microsoft.DirectX.Direct3DX as D3DX" doesn't work.
> Thanks for help.

What is the actual name of the _assembly_ that implements the 
Direct3DX library?

Remember that the name-based import in Python is linked to 
namespaces, and 'implicit assembly loading' only happens if 
the namespace you are trying to import happens to match the 
name of the assembly implementing it (which luckily is often, 
but not always, the case).

So for example, if the assembly is actually named 'Direct3DX.dll', 
you'll need to load the assembly explicitly before attempting to 
import the namespace, since the names don't match. There is an 
example of this in the README for Python for .NET:

          from CLR.System.Reflection import Assembly

          a = Assembly.LoadWithPartialName("SomeAssembly")

          # now we can import namespaces defined in that assembly

          from CLR.SomeNamespace import Something


Brian Lloyd        brian at zope.com
V.P. Engineering   540.361.1716              
Zope Corporation   http://www.zope.com 

More information about the PythonDotNet mailing list