Artem Zhukov Artem Zhukov - 1 year ago 121
Python Question

Adding reference to .net assembly which has dots in name and namespace

I am trying to refer to assembly which has dots in the namespace.



print 'isc.Eng.Hov' in clr.ListAssemblies(False)

from isc.Eng.Hov import *

Interpreter raises an error:

Traceback (most recent call last):
File "/mnt/86f8c6c8-9099-4f32-be68-486a12918546/GoogleDrive/__BACKLOG/RMK_API_LIB/rmkSuppliersDLLswrappers/scr/Hoval/", line 14, in <module>
from isc.Eng.Hov import *
ImportError: No module named isc.Eng.Hov

How to troubleshoot?

Answer Source

the solution was to use ILSPY to investigate the DLL and find dependencies (right click recursively for each DLL and click on add dependencies). Then I copied all the dependencies to the same folder where the main DLL was. After that, I ran:

print [a for a in clr.ListAssemblies(False)

and get the list of dependencies which are actually involved:

u'isc.Eng.Hov', u'Microsoft.VisualBasic', u'System.Windows.Forms', u'System.Drawing', u'Accessibility'

and left them in the folder. After doing so the part of code:



import isc.Eng.Hov as isk
from isk import *

started work.

Thank you all, especially @denfromufa for help!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download