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
Currently installed "classic" .NET Versions in the system:
4.0.0.0
4.8.09032
Details
In Python, I am trying to use a .NET DLL supplied by a hardware vendor ("Suragus"). The DLL targets .NET Framework 4.6.1. I can add it as a reference, see its references, and load it, but I get a ModuleNotFoundError when I import a namespace that it provides.
I am investigating three possible causes of the issue.
Does Pythonnet support the use of DLLs targeting .NET Framework 4.6.1? I saw this closed issue, but am not sure whether it refers to the target version of a .NET DLL, or the runtime, or both. I cannot find a definitive statement of the Pythonnet's compatibility with the target version of a .NET DLL.
My lack of a runtimeconfig.json file. The vendor has not supplied one. As above, I have .NET Framework 4.0 and 4.8 on my system. Could Pythonnet be selecting 4.0? The output from get_runtime_info does not say. The vendor states that .NET Framework 4.6.1 or above is required.
A missing referenced DLL. The DLL that I am trying to load references a DLL that is not present. The vendor assures me that this DLL is not necessary, but maybe it presents a problem for Pythonnet? The assembly can be added and loaded (see code below).
I realize that this is partly a support request, but it also relates to the completeness of documentation and specificity of error messages, which is why I'm posting it here.
Here is the code that I am using to investigate. I have described the output in comments, but cannot share it in full.
importpythonnetaspnimportclrprint(pn.get_runtime_info())
#Runtime: .NET Framework#=============# Version: <undefined># Initialized: True# Shut down: False# Properties:# domain =# config_file = None## I can add it as a reference. The printed description makes sense.sdk=clr.AddReference("Suragus.Ec.Sdk")
print("SDK:", sdk)
# I can get its referenced assemblies. These are consistent with ILSpy.fromSystem.ReflectionimportAssemblysdk_references=Assembly.GetReferencedAssemblies(sdk)
print("Referenced Assemblies:")
foriteminsdk_references:
print(item)
# Most the the referenced assemblies are printed here, but some are missing. The vendor asserts that they are not necessary.print("ListAssemblies:")
foriteminclr.ListAssemblies(True):
print(item)
loaded_sdk=Assembly.Load("Suragus.Ec.Sdk")
print("Loaded:", loaded_sdk)
# But importing a namespace raises: "ModuleNotFoundError: No module named 'Suragus'".importSuragus
The text was updated successfully, but these errors were encountered:
Environment
Details
In Python, I am trying to use a .NET DLL supplied by a hardware vendor ("Suragus"). The DLL targets .NET Framework 4.6.1. I can add it as a reference, see its references, and load it, but I get a ModuleNotFoundError when I import a namespace that it provides.
I am investigating three possible causes of the issue.
get_runtime_info
does not say. The vendor states that .NET Framework 4.6.1 or above is required.I realize that this is partly a support request, but it also relates to the completeness of documentation and specificity of error messages, which is why I'm posting it here.
Here is the code that I am using to investigate. I have described the output in comments, but cannot share it in full.
The text was updated successfully, but these errors were encountered: