[Python.NET] Python for .NET load .dll

Gianni Iannelli giannicristian at msn.com
Mon Jun 8 09:44:16 CEST 2015

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.34209It 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>
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:http://stackoverflow.com/questions/14633695/how-to-install-python-for-net-on-windows,http://stackoverflow.com/questions/13259617/python-for-net-unable-to-find-assembly-errorhttps://github.com/geographika/PythonDotNet
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! 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20150608/3c7352c9/attachment-0001.html>

More information about the PythonDotNet mailing list