Skip to content

Initialize() crash from .NET Framework application #2205

@anovik

Description

@anovik

Environment

  • Pythonnet version: 3.0.1
  • Python version: 3.10
  • Operating System: windows 11/10
  • .NET Runtime: NET Framework 4.6.1

Details

I am trying to call Python code from .NET Framework app but on some machines PythonEngine.Initialize() crashes.

Runtime.PythonDLL = "C:\\Python\\Python310\\python310.dll";
PythonEngine.Initialize();

Exception:

System.TypeInitializationException: 'The type initializer for 'Delegates' threw an exception.'

There are two inner exceptions:

DllNotFoundException: Could not load C:\Python\Python310\python310.dll.
Win32Exception: %1 is not a valid Win32 application

The path is correct and the dll exists.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions