You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pythonnet compiled under VS2015. Demo packages work fine (wordpad.py etc) but I get an error trying to call python from .net using the Python.Runtime.dll.
When calling PythonEngine.Initialize(); the following error occurs in runtime.cs Line 188.
"A call to PInvoke function 'Python.Runtime!Python.Runtime.Runtime::PyDict_GetItemString' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature."
I have confirmed that the version being compiled is for windows 32bit and Python 2.7. Any suggestion much appreciated.
OK Ive checked further and Ive traced it to f1aa89b (sorry I was incorrect earlier).
The issue is the removal of the calling convention in [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl)].
When googleing the error message earlier this is one of the thing that came up as a possible cause. So looks like this is the problem. Adding the CallingConvention back in on the latest commit should resolve the issue.
Activity
filmor commentedon Mar 31, 2017
Which version (i.e. commit) are you using exactly? Can you bisect the error?
jwlc76 commentedon Mar 31, 2017
Tested with the latest commit as of a the 31-01-2017. I will try and replicate with an earlier version.
jwlc76 commentedon Mar 31, 2017
The issues first occurs in c7b4c21 (commit on the 1 march 2017)
den-run-ai commentedon Mar 31, 2017
@jwlc76 thank you for reporting this issue!
@vmuriart do you see anything suspicious in that commit? It looks like only refactoring to me.
jwlc76 commentedon Mar 31, 2017
OK Ive checked further and Ive traced it to f1aa89b (sorry I was incorrect earlier).
The issue is the removal of the calling convention in [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl)].
When googleing the error message earlier this is one of the thing that came up as a possible cause. So looks like this is the problem. Adding the CallingConvention back in on the latest commit should resolve the issue.
den-run-ai commentedon Mar 31, 2017
@vmuriart well, I did mention this before, not sure why you ended up removing calling convention anyway?
#403 (comment)
jwlc76 commentedon Mar 31, 2017
Just to confirm adding back in the CallingConvention to the DllImports in runtime.cs on the master commit works for me.
den-run-ai commentedon Mar 31, 2017
@jwlc76 feel free to submit a pull request to add cdecl back! Let us know, thanks again.
vmuriart commentedon Mar 31, 2017
The issue was with some of the other arguments (especially
charset). I'll take care of re-adding thecallingconvthis weekend.Re-add CallingConvention
Rebase with master (#2)