- Notifications
You must be signed in to change notification settings - Fork749
Closed
Description
Environment
- Pythonnet version: 3.0
- Python version: 3.11
- Operating System: Windows 10
- .NET Runtime: Net Framework 4.7.1
Details
Describe what you were trying to get done.
I was trying to test the features of pythonnet because I was really hopeful for this api.
What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.
I tried setting the DLL location with the variable and it straight up crashes. I tried using the python38 dll but that gives the same error.
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Delegates' threw an exception. ---> System.DllNotFoundException: Could not load C:\Users\Awire\source\repos\pythonnettest\pythonnettest\bin\Debug\python311.dll. ---> System.ComponentModel.Win32Exception: %1 is not a valid Win32 application --- End of inner exception stack trace --- at Python.Runtime.Platform.WindowsLoader.Load(String dllToLoad) at Python.Runtime.Runtime.Delegates.GetUnmanagedDll(String libraryName) at Python.Runtime.Runtime.Delegates..cctor() --- End of inner exception stack trace --- at Python.Runtime.Runtime.Delegates.get_Py_IsInitialized() at Python.Runtime.Runtime.Py_IsInitialized() at Python.Runtime.Runtime.<>c.<Initialize>b__32_0() at Python.Runtime.Runtime.TryUsingDll[T](Func`1 op) at Python.Runtime.Runtime.Initialize(Boolean initSigs) at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv, Boolean initSigs) at Python.Runtime.PythonEngine.Initialize() at pythonnettest.Program.Main(String[] args) in C:\Users\Awire\source\repos\pythonnettest\pythonnettest\Program.cs:line 17C:\Users\Awire\source\repos\pythonnettest\pythonnettest\bin\Debug\python311.dll. ---> System.ComponentModel.Win32Exception: %1 is not a valid Win32 application --- End of inner exception stack trace --- at Python.Runtime.Platform.WindowsLoader.Load(String dllToLoad) at Python.Runtime.Runtime.Delegates.GetUnmanagedDll(String libraryName) at Python.Runtime.Runtime.Delegates..cctor() --- End of inner exception stack trace --- at Python.Runtime.Runtime.Delegates.get_Py_IsInitialized() at Python.Runtime.Runtime.Py_IsInitialized() at Python.Runtime.Runtime.<>c.<Initialize>b__32_0() at Python.Runtime.Runtime.TryUsingDll[T](Func`1 op) at Python.Runtime.Runtime.Initialize(Boolean initSigs) at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv, Boolean initSigs) at Python.Runtime.PythonEngine.Initialize() at pythonnettest.Program.Main(String[] args) in C:\Users\Awire\source\repos\pythonnettest\pythonnettest\Program.cs:line 17
My C# code
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using Python.Runtime;using Python;using System.IO;namespace pythonnettest{ internal class Program { static void Main(string[] args) { Runtime.PythonDLL = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\python311.dll"; PythonEngine.Initialize(); PythonEngine.Exec("print('Hello')"); } }}
- If there was a crash, please include the traceback here.
N/A
Metadata
Metadata
Assignees
Labels
No labels