[Python.NET] Referencing a DLL

Denis Akhiyarov denis.akhiyarov at gmail.com
Mon Oct 17 11:01:57 EDT 2016


are you on Linux and Mono? What python/Mono/pythonnet versions and
architecture?

On Mon, Oct 17, 2016 at 9:57 AM, Artem Zhukov <green.azhukov at gmail.com>
wrote:

> In [6]: clr.AddReference("isc.Eng.Hov")
> Out[6]: <System.Reflection.MonoAssembly at 0x7fa5fc0848d0>
>
> In [7]: import isc.Eng.Hov
> ------------------------------------------------------------
> ---------------
> ImportError                               Traceback (most recent call last)
> <ipython-input-7-4f185d6b3880> in <module>()
> ----> 1 import isc.Eng.Hov
>
> ImportError: No module named isc.Eng.Hov
>
> On Mon, Oct 17, 2016 at 4:56 PM Artem Zhukov <green.azhukov at gmail.com>
> wrote:
>
>> On my machine:
>> In [6]: clr.AddReference("isc.Eng.Hov")
>> Out[6]: <System.Reflection.MonoAssembly at 0x7fa5fc0848d0>
>>
>> In [7]: import isc.Eng.Hov
>> ------------------------------------------------------------
>> ---------------
>> ImportError                               Traceback (most recent call
>> last)
>> <ipython-input-7-4f185d6b3880> in <module>()
>> ----> 1 import isc.Eng.Hov
>>
>> ImportError: No module named isc.Eng.Hov
>>
>> On Mon, Oct 17, 2016 at 4:28 PM Denis Akhiyarov <
>> denis.akhiyarov at gmail.com> wrote:
>>
>> I used ILSPY to inspect your dll and here is how you need to use it (just
>> tried and it works!):
>>
>> In [1]: import clr
>>
>> In [2]: import sys
>>
>> In [3]: sys.path.append(r"C:\Users\denis.akhiyarov\Downloads\
>> TestEngine_Compile
>>    ...: d")
>>
>> In [4]: clr.AddReference("isc.Eng.Hov")
>> Out[4]: <System.Reflection.RuntimeAssembly at 0x51de4a8>
>>
>> In [5]: import isc.Eng.Hov
>>
>> In [6]: from isc.Eng.Hov import *
>>
>> On Mon, Oct 17, 2016 at 8:32 AM, Artem Zhukov <green.azhukov at gmail.com>
>> wrote:
>>
>> Denis,
>>
>> 1. from isc.Eng.Hov import * . Result: ImportError: No module named
>> isc.Eng.Hov
>> 2. import HovEngine. Result: ImportError: No module named HovEngine
>> 3. import isc.Eng.Hov.HovEngine. Result: ImportError: No module named
>> isc.Eng.Hov.HovEngine
>> 4. from isc.Eng.Hov.HovEngine import *. Result ImportError: No module
>> named isc.Eng.Hov.HovEngine
>>
>> I don't know where the mistake could be hidden. As I see from object
>> browser the namespace is HovEngine.
>> [image: unspecified.jpg]
>> Then, what's wrong?
>>
>> On Mon, Oct 17, 2016 at 2:12 PM Denis Akhiyarov <
>> denis.akhiyarov at gmail.com> wrote:
>>
>> Hi Artem,
>>
>> If clr.FindAssembly("isc.Eng.Hov") and clr.AddReference("isc.Eng.Hov")
>> are working fine, then you need to `import HovEngine`, but not `import
>> isc.Eng.Hov`.
>>
>> This is assuming isc.Eng.Hov is assembly name, and HovEngine is namespace
>> name.
>>
>> Thanks,
>> Denis
>>
>> On Mon, Oct 17, 2016, 12:08 AM Artem Zhukov <green.azhukov at gmail.com>
>> wrote:
>>
>> Hello all,
>> please help me to resolve the following problem. I was trying a lot of
>> things (see 1) and still didn't get it. There is also a project on
>> freelancer for that (see 2):
>>
>>    1. http://stackoverflow.com/questions/40037684/adding-
>>    reference-to-net-assembly-which-has-dots-in-name-and-namespace
>>    <http://stackoverflow.com/questions/40037684/adding-reference-to-net-assembly-which-has-dots-in-name-and-namespace>
>>    2. https://www.freelancer.com/contest/Write-some-Software-867914.html
>>
>>
>> --
>> ARTEM ZHUKOV | HVAC/Mech.Engineer | Building Performance Engineer |
>> Sustainability Engineer | HVAC TPM | M: +420 774 081 898
>> <774%20081%20898>
>>
>> _________________________________________________
>> Python.NET mailing list - PythonDotNet at python.org
>> https://mail.python.org/mailman/listinfo/pythondotnet
>>
>> _________________________________________________
>> Python.NET mailing list - PythonDotNet at python.org
>> https://mail.python.org/mailman/listinfo/pythondotnet
>>
>> --
>> ARTEM ZHUKOV | HVAC/Mech.Engineer | Building Performance Engineer |
>> Sustainability Engineer | HVAC TPM | M: +420 774 081 898
>>
>> _________________________________________________
>> Python.NET mailing list - PythonDotNet at python.org
>> https://mail.python.org/mailman/listinfo/pythondotnet
>>
>>
>> _________________________________________________
>> Python.NET mailing list - PythonDotNet at python.org
>> https://mail.python.org/mailman/listinfo/pythondotnet
>>
>> --
>> ARTEM ZHUKOV | HVAC/Mech.Engineer | Building Performance Engineer |
>> Sustainability Engineer | HVAC TPM | M: +420 774 081 898
>> <774%20081%20898>
>>
> --
> ARTEM ZHUKOV | HVAC/Mech.Engineer | Building Performance Engineer |
> Sustainability Engineer | HVAC TPM | M: +420 774 081 898
>
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> https://mail.python.org/mailman/listinfo/pythondotnet
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20161017/10bc38c9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unspecified.jpg
Type: image/jpeg
Size: 6278 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20161017/10bc38c9/attachment-0001.jpg>


More information about the PythonDotNet mailing list