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
Hi, thanks for the great library! It has been tremendously helpful in both my personal and professional life!
Right now I am encountering a problem that might not be pythonnet specific but is not obvious to solve and encountered when I use Pythonnet. Specifically, when my project references SkiaSharp which contains native dlls, pythonnet will not be able to load everything properly - it locates the entry assembly fine, but the dependencies are not loaded. The initial import is ok but during runtime an exception is thrown.
Would love to hear any suggestions on solving this problem.
Environment
Pythonnet version: 3.0.5
Python version: 3.11.9 64bit
Operating System: Windows 7 64-bit
Below is the entry assembly, which directly references SkiaSharp.
And this is how I am referencing the entry assembly, from some location outside the published folder (notice the same problem happens even if this script is placed directly inside the published folder).
importsyssys.path.insert(0, r"C:\Users\Charles Zhang\Desktop\Temp\PythonNetSkiaSharpProblem\PythonNetSkiaSharpProblem\bin\Debug\net8.0")
importpythonnetpythonnet.load("coreclr")
importclrclr.AddReference("PythonNetSkiaSharpProblem")
fromPythonNetSkiaSharpProblemimportProgramProgram.Main([]) # Exception in stack
Output:
System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception.
---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp' or one of its dependencies: The specified module could not be found. (0x8007007E)
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor()
--- End of inner exception stack trace ---
at SkiaSharp.SKImageInfo..ctor(Int32 width, Int32 height)
at PythonNetSkiaSharpProblem.Program.Main(String[] args) in C:\Users\Charles Zhang\Desktop\Temp\PythonNetSkiaSharpProblem\PythonNetSkiaSharpProblem\Program.cs:line 11
Notice a workaround is to copy libSkiaSharp.dll directly to the root of the published folder.
But this won't work cross-platform and also if we have many similar libraries that exhibit similar behavior then it's not convenient.
Hi, thanks for the great library! It has been tremendously helpful in both my personal and professional life!
Right now I am encountering a problem that might not be pythonnet specific but is not obvious to solve and encountered when I use Pythonnet. Specifically, when my project references SkiaSharp which contains native dlls, pythonnet will not be able to load everything properly - it locates the entry assembly fine, but the dependencies are not loaded. The initial import is ok but during runtime an exception is thrown.
Would love to hear any suggestions on solving this problem.
Environment
Below is the entry assembly, which directly references SkiaSharp.
And this is how I am referencing the entry assembly, from some location outside the published folder (notice the same problem happens even if this script is placed directly inside the published folder).
Output:
This is likely due to this folder structure:
See: https://github.com/Charles-Zhang-Python/PythonNetSkiaSharpProblem
This might be related to #468 but is somewhat different since I am not loading the dll directly, and everything is .Net 8 properly.
The text was updated successfully, but these errors were encountered: