4

clr モジュールの AddReference('example_file') メソッドを使用して、「example_file.dll」への参照を追加しようとしています。

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

その結果、次のようになります。

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)

すべてのファイルは現在の作業ディレクトリにあり、sys.path は次のようになります。

>>> 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\\']

さらに、次の結果として:

>>>clr.FindAssembly('example_file')

私は得る

u'example_file.dll 

問題は日々発生しました。以前は問題なく機能していたので、混乱しています。これに何が影響するのかわかりません。Windows 7 x64、python 2.73、および.Net Framework 4で作業しています

4

1 に答える 1