C# Can';t在python中导入DLL&引用;找不到程序集错误“;

C# Can';t在python中导入DLL&引用;找不到程序集错误“;,c#,python,dll,dllimport,python.net,C#,Python,Dll,Dllimport,Python.net,我有几个C#程序正在尝试转换成python。我对C#一无所知,我必须导入DLL并使用C#代码中使用的函数。我已在其他代码中成功导入DLL,但无法在此特定代码中导入 这是我试图引用的C代码: namespace Grab { public partial class Form1 : Form { [DllImport("kernel32.dll")] public static extern void CopyMemory(IntPtr Desti

我有几个C#程序正在尝试转换成python。我对C#一无所知,我必须导入DLL并使用C#代码中使用的函数。我已在其他代码中成功导入DLL,但无法在此特定代码中导入

这是我试图引用的C代码:

namespace Grab
{

    public partial class Form1 : Form
    {
        [DllImport("kernel32.dll")]
        public static extern void CopyMemory(IntPtr Destination, IntPtr Source, int Length);

        private const string SdkFilePath = @".\xyz.dll";


        [DllImport(SdkFilePath, CallingConvention = CallingConvention.StdCall)]
        public static extern UInt32 LP_GetLibVersion();

我在Python中所做的工作:

import clr
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "\\DLL\\") #Load DLL file
clr_iow = clr.AddReference("xyz")
C#程序运行得很好。但是当我尝试运行python代码时, 我得到这个错误:

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    clr_iow = clr.AddReference("xyz")
System.IO.FileNotFoundException: Unable to find assembly 'xyz'.
   at Python.Runtime.CLRModule.AddReference(String name)
然后在python中:

import clr
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "\\DLL\\") #Load DLL file
clr_iow = clr.AddReference("abc")
为什么我不能在这里这么做?提前谢谢

import clr
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "\\DLL\\") #Load DLL file
clr_iow = clr.AddReference("abc")