Skip to content Skip to sidebar Skip to footer

Pythonnet Filenotfoundexception: Unable To Find Assembly

I am trying to execute a Python script that uses Python For .Net (https://github.com/pythonnet/pythonnet) to load a C# library called 'Kratos_3.dll' which is in the same folder as

Solution 1:

It turns out that even though I added the path through

sys.path.insert(0,"C:\\dev\\proj_1\\")

it still couldn't find the file because the .dll because Windows was not enabling it to load from "external sources". To fix this:

  1. Right-click on the .dll
  2. "Properties"
  3. Under "General", click "Unblock"

Solution 2:

Another possible reason Python for NET is unable to find lib is different platforms of Python and assemblies. Python 64-bit can't see x86 Dlls, and Python 32-bit can't see x64. Make sure your lib match Python platform, or compile them as AnyCPU.

Post a Comment for "Pythonnet Filenotfoundexception: Unable To Find Assembly"