I am trying to use the DLL 'codessentials.CGM.dll' in python (you can find it in https://www.nuget.org/packages/codessentials.CGM/ or https://github.com/twenzel/CGM).
My goal is to convert a .cgm file in binary encoding to a .cgm file in clear text format. For this, I use the following code :
import os, sys, clr
dll_dir = './'
sys.path.append(os.getcwd())
path = r'%s%s' % (dll_dir, 'System.Text.Encoding.CodePages')
clr.AddReference(path)
path = r'%s%s' % (dll_dir, 'System.Runtime.CompilerServices.Unsafe')
clr.AddReference(path)
path = r'%s%s' % (dll_dir, 'codessentials.CGM')
clr.AddReference(path)
from codessentials.CGM import BinaryCgmFile, ClearTextCgmFile
binaryFile = BinaryCgmFile('test.cgm')
cleanTextFile = ClearTextCgmFile(binaryFile)
content = cleanTextFile.GetContent()
The import works but, when I try to use the function 'GetContent', the code yields the following error:
Traceback (most recent call last):
File "C:/Users/llyili/PycharmProjects/test_decode_cgm/main.py", line 16, in <module>
content = cleanTextFile.GetContent()
System.IO.FileNotFoundException: Impossible de charger le fichier ou l'assembly 'System.Text.Encoding.CodePages, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ou une de ses dépendances. Le fichier spécifié est introuvable.
à codessentials.CGM.Export.DefaultClearTextWriter..ctor(Stream stream)
à codessentials.CGM.ClearTextCgmFile.WriteFile(Stream stream)
à codessentials.CGM.ClearTextCgmFile.GetContent()
Is there any way to find out why the import of a DLL used by a DLL is failling ?
I try to import the DLL 'System.Text.Encoding.CodePages' with clr, but I can't find the version 4.1.3.0 in Internet so I import the version 5.0.0.0 in the code below.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…