Getting error on my code while , I am importing the pdfplumber #1103
jitendra12300
started this conversation in
Ask for help with specific PDFs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Error: Python.Runtime.PythonException: 'DLL load failed while importing _rust: The specified module could not be found.'
C#, .net windows form
Code:
public static bool ExportBOMPdfFileToExcel(string fileName)
{
try
{
if (File.Exists(fileName) == false)
{
return false;
}
string? pythonnetPYDllKey = Convert.ToString(ConfigurationManager.AppSettings["Environment_PythonnetPYDllKey"]);
if (string.IsNullOrEmpty(pythonnetPYDllKey) == false && string.IsNullOrEmpty(Environment.GetEnvironmentVariable(pythonnetPYDllKey)) == true)
{
setEnvironmentVariables();
}
PythonEngine.Initialize();
dynamic? pyResult;
// DrawingCheckListAttributeVM drawingCheckListAttributeVM = new DrawingCheckListAttributeVM();
Dictionary<string, string> drawingAttributes = new();
using (Py.GIL())
{
string? pyFilePath = Convert.ToString(ConfigurationManager.AppSettings["ExportBOMPdfToBOMExcel"]);
dynamic os = Py.Import("os");
dynamic sys = Py.Import("sys");
dynamic pdfminer = Py.Import("pdfminer");
dynamic pdfplumber = Py.Import("pdfplumber");// this line throwing error
sys.path.append(os.path.dirname(os.path.expanduser(pyFilePath)));
#pragma warning disable CS8604 // Possible null reference argument.
var fromFile = Py.Import(Path.GetFileNameWithoutExtension(pyFilePath));
#pragma warning restore CS8604 // Possible null reference argument.
Beta Was this translation helpful? Give feedback.
All reactions