[Python] clr.AddReference('example_file') - unable to find assembly

Discussão em 'Python' iniciado por Stack, Agosto 23, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to add reference to "example_file.dll" using AddReference('example_file') method from clr module:

    >>>import clr
    >>>clr.AddReference('example_file')


    and in result I get:

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    System.IO.FileNotFoundException: Unable to find assembly 'example_file'.

    at Python.Runtime.CLRModule.AddReference(String name)


    All files are located in current working directory and sys.path looks like this:

    >>> sys.path
    ['', 'C:\\Python27\\lib\\site-packages\\pip-1.2.1-py2.7.egg', 'C:\\Python27', 'C
    :\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib',
    'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27\\lib\\
    site-packages', 'C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\']


    Additionally, in result of:

    >>>clr.FindAssembly('example_file')


    I get

    u'example_file.dll


    The problem arose from day to day. I am confused because it worked fine before - I don't know what could affect on this. I am working with Windows 7 x64, python 2.73 and .Net framework 4

    Continue reading...

Compartilhe esta Página