On Feb 7, 9:38 pm, Huayang Xia <[EMAIL PROTECTED]> wrote: > On Feb 7, 3:30 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > > > > > On Feb 7, 2:35 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote: > > > > On 7 feb, 05:52, Fuzzyman <[EMAIL PROTECTED]> wrote: > > > > > Luis M. González wrote: > > > > > On 6 feb, 21:17, Fuzzyman <[EMAIL PROTECTED]> wrote: > > > > > > On Feb 6, 9:59 pm, "Luis M. Gonz�lez" <[EMAIL PROTECTED]> wrote: > > > > > > > > On Feb 6, 6:27 pm, Huayang Xia <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hello All, > > > > > > > > > I have several .NET DLL (I have no source code for them), is > > > > > > > > there > > > > > > > > anyway to use them from python instead of from C#. > > > > > > > > > Thanks, > > > > > > > > Huayang > > > > > > > > I used to put my .dll files into the .DLL folder, so I could > > > > > > > simply > > > > > > > import them as I would with any other python module. > > > > > > > But since I started using Ironpython 2.0 Alpha* this doesn't work > > > > > > > anymore... > > > > > > > Any hint? > > > > > > > The rule is probably still that the DLLs must be in a directory on > > > > > > sys.path for the interpreter to find them. Try adding the directory > > > > > > containing the assemblies to sys.path and see if you can add > > > > > > references to them. > > > > > > > Michael Foordhttp://www.manning.com/foord > > > > > > > > Luis > > > > > > I tried adding the directory to sys.path. > > > > > Still not working... > > > > > > >>> import sys > > > > > >>> sys.path.append('C:\Documents and > > > > > >>> Settings\luismg\Escritorio\IronPython-2.0A > > > > > 8\DLLs') > > > > > >>> from ClassLibrary1 import * > > > > > Traceback (most recent call last): > > > > > File , line unknown, in ##235 > > > > > File , line unknown, in _stub_##2 > > > > > ImportError: No module named ClassLibrary1 > > > > > You need to add references to assemblies before you can import from > > > > the namespaces they contain. > > > > > import clr > > > > clr.AddReference('ClassLibrary1') > > > > > HTH > > > > > Fuzzymanhttp://www.manning.com/foord > > > > Oh, I know what you mean. > > > But that was exactly the reason for having a .DLLs folder, isn't it? > > > When you place an assembly into this folder, you avoid having to write > > > this boilerplate code, and simply import the assembly as you would > > > with a normal python module. At least, that´s how it worked in > > > previous versions... > > > No. You have always had to add references to assemblies before being > > able to use the namespaces they contain. You even have to do this with > > C# in Visual Studio. > > > Michaelhttp://www.manning.com/foord > > Is there any special .NET DLL format for IronPython to import (e.g. > rename the DLL to .pyd). Why when I try to import the DLL, it always > complain the module doesn't exist?
First you need to make sure the DLL is on the path - and *then* you need to add a reference to the assembly (dll) as I showed earlier. Michael -- http://mail.python.org/mailman/listinfo/python-list