Victor, thanks for your response. I did try a simple C# test code and it's working as expected. So, both C# and IronPython calls work, but I still need Python.Net to work. Alex, Спасибо.. On Wed, Jan 27, 2021 at 8:27 PM Victor “LOST” Milovanov < lostfreeman@gmail.com> wrote:
Can you try this from C# interactive (or plain C#)?
#r "C:\Test_MW\Tools\GuiTest\ExamRecordHelper.dll"
using ExamRecordHelper;
var record = new ExamRecordLoader("C:\\Test_MW\\Tools\\ExamRecords\\Resp4DCT");
Without having ExamRecordHelper.dll, it is hard to guess otherwise, but I agree with Manu, this looks like a mistake in the code (different files and/or different versions of the DLL being loaded).
Regards,
Victor
*From: *AlexM <alexmasis@gmail.com> *Sent: *Wednesday, January 27, 2021 5:16 PM *To: *A list for users and developers of Python.NET <pythonnet@python.org> *Subject: *[Python.NET] Re: Binary file passed to .Net object
Manu, thank you very much for your suggestions...
So, far I have .dll and these are not the solutions.
Also, the exact same code works in IronPython, b.t.w.....
Well, the error does come from the "ExamRecordLoader", here is the output:
c:\Test_MW\Tools\GuiTest>python getExamRecord.py Load Exam Record Could not load Exam Record: Error loading ExamRecord binary file: C:\\Test_MW\\Tools\\ExamRecords\\Resp4DCT Column requires a valid DataType. at ExamRecordHelper.ExamRecordLoader.LoadExamRecord(String filename) at ExamRecordHelper.ExamRecordLoader..ctor(String filename)
And this is the source:
import clr try: ExRHelperAsseblyRef = clr.AddReference("C:\\Test_MW\\Tools\\GuiTest\\ExamRecordHelper.dll") from ExamRecordHelper import *
except Exception, e: print("Exception : " + str(e))
# path to binary file: examRecordFile = r'C:\\Test_MW\\Tools\\ExamRecords\\Resp4DCT'
try: print "Load Exam Record" exrec = ExamRecordLoader(examRecordFile) # <<<<<<<<<<<<<<<<<<<<< Exception line stepList=exrec.GetStepList() print "stepList="+str(stepList) except Exception as e: print "Could not load Exam Record: ", str(e)
Alex.
On Wed, Jan 27, 2021 at 3:54 PM Emmanuel Rutovic <manu@aesim.tech> wrote:
Hi Alex,
It seems that the exception is thrown inside your method "ExamRecordLoader" so it is hard to debug.
Is it possible that the error is thrown because of different working directories? Can you try to use the full path to 'MyBinaryFile.bin' ?
Also, I always use the file name including the extension ( clr.AddReference("C:\ExamRecordHelper*.dll*") ) but I doubt it will change anything
I hope it helps,
Manu.
On Wed, Jan 27, 2021 at 2:47 PM Alexander Masis <alexmasis@gmail.com> wrote:
The code in the original post works in IronPython ( i.e. loaderObj = ExamRecordLoader( 'MyBinaryFile.bin') this line has no exceptions in IronPython ) _______________________________________________ PythonNet mailing list -- pythonnet@python.org To unsubscribe send an email to pythonnet-leave@python.org https://mail.python.org/mailman3/lists/pythonnet.python.org/ Member address: manu@upsim.tech
_______________________________________________ PythonNet mailing list -- pythonnet@python.org To unsubscribe send an email to pythonnet-leave@python.org https://mail.python.org/mailman3/lists/pythonnet.python.org/ Member address: alexmasis@gmail.com
_______________________________________________ PythonNet mailing list -- pythonnet@python.org To unsubscribe send an email to pythonnet-leave@python.org https://mail.python.org/mailman3/lists/pythonnet.python.org/ Member address: alexmasis@gmail.com