Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Win32Exception when running PythonEngine.Initialize()#2559

Unanswered
bflo96 asked this question inQ&A
Discussion options

Environment

  • PythonNET version: 3.0.5
  • Python Version: 3.9
  • Operating System: Windows 10
  • .NET Framework 4.7.2
  • Visual Studio 2019

Hello everyone!
It's my first time posting on this community, so I'm sorry advance if there's any information missing in this post. I will edit accordingly in that case.

I have the following:

using Python.Runtime;namespace Test_PythonNET{    class Program    {        static void Main(string[] args)        {            RunScript("PythonApplication3");        }        public static void RunScript(string scriptName)        {            Runtime.PythonDLL = @"C:\Program Files(x86)\Microsoft Visual Studio\Shared\Python39_64\python39.dll";            PythonEngine.Initialize();            using (Py.GIL())            {                var pythonScript = Py.Import(scriptName);                pythonScript.InvokeMethod("say_hello");            }        }    }}

I've already set: Properties > Build > Platform Target x86.
It's giving me (apparently the very common) error of:

Exception Unhandled
System.TypeInitializationException: 'The type initializer for 'Delegates' threw an exception.'
2 of 2 Inner Exceptions
Win32Exception: The specified module could not be found

I have the following Individual components installed:
image

Any idea what I'm possibly doing wrong? I found other similar discussions but I don't think any of them installed Python the same way I did. It's my first time using both Python and Python.NET.

Thank you!

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
1 participant
@bflo96

[8]ページ先頭

©2009-2025 Movatter.jp