You probably need to escape those backslashes, no? e.g.
'C:\\Program Files\\API\\Test.NET'

On Mon, Jun 8, 2015 at 3:44 AM, Gianni Iannelli <giannicristian@msn.com> wrote:

Dear All,


I have a problem loading an external dll using Python through Python for .NET. I have tried different methodologis following stackoverflow and similar. I will try to summarize the situation and to describe all the steps that I've done.

I have a dll named for e.g. Test.NET.dll. I checked with dotPeek and I can see, clicking on it, x64 and .NET Framework v4.5. On my computer I have installed the .Net Framework 4.

I have also installed Python for .NET in different ways. I think that the best one is download the .whl from this website http://www.lfd.uci.edu/~gohlke/pythonlibs/#pythonnet . I have downloaded and installed: pythonnet‑2.0.0.dev1‑cp27‑none‑win_amd64.whl. I can imagine that it will works for .NET 4.0 sinceRequires the Microsoft .NET Framework 4.0.


Once I have installed everything, I can do these commands:


>>> import clr
>>> import System
>>> print System.Environmnet.Version
>>> print System.Environment.Version
4.0.30319.34209

It seems work. Then, I have tried to load my dll typing these commands:


>>> import clr
>>> dllpath= r'C:\Program Files\API\Test.NET'
>>> clr.AddReference(dllpath)

Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    clr.AddReference(dllpath)
FileNotFoundException: Unable to find assembly 'C:\Program Files\API\Test.NET'.
   at Python.Runtime.CLRModule.AddReference(String name)

I have also tried to add '.dll' at the end of the path but nothing changed. Then, I have also tried different solutions as described in:


and much more.... Unfortunately, it doesn't work and I get different errors. I know that exists IronPython but I was trying to avoid to use it.


Thanks for your help!


_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
https://mail.python.org/mailman/listinfo/pythondotnet



--
47 Lining
Brian Lloyd, SVP Engineering
Cloud Advisory and Development Services
M +1.540.845.2975 | E brian.lloyd@47lining.com | W www.47lining.com
This message and any attachments are confidential and intended solely for the individual(s) or entity to which it is addressed. If you are not the intended recipient, do not read, copy or distribute the email or any attachments. Please notify the sender immediately by return e-mail.