- Notifications
You must be signed in to change notification settings - Fork750
Description
Environment
- Pythonnet version: Newest, built from github - commitf2dc8f1
- Python version: ??
- Operating System: Windows 10
- .NET Runtime: .net framework 4.5
Details
Hi, I'm trying to switch from IronPython to pythonnet in myproject. Unfortunately, I can't make the engine work.
I'm trying to create the engine like this, but it throws an exception:
public class PythonEngine : IDisposable { private ClientHandler client; private Py.GILState _engine; private PyScope _scope; private GameAPI _gameAPI; public PythonEngine(ClientHandler client) { this.client = client; _engine = Py.GIL(); _scope = Py.CreateScope(); _gameAPI = new GameAPI(client, _scope); PrepareStaticLocals(); var outputStream = new MemoryStream(); var outputStreamWriter = new TcpStreamWriter(outputStream, client); //_engine.Runtime.IO.SetOutput(outputStream, outputStreamWriter); }...}
I am not wrapping the code inusing
statement because I need to use the same scope later in the code (I dispose it manually instead). Anyway, the code throws this exception:
System.TypeInitializationException: Inicializační metoda typu Delegates vyvolala výjimku. ---> System.MissingMethodException: Failed to load symbol PyDictProxy_New ---> System.ComponentModel.Win32Exception: Uvedená procedura nebyla nalezena --- Konec trasování zásobníku pro vnitřní výjimku --- v Python.Runtime.Platform.WindowsLoader.GetFunction(IntPtr hModule, String procedureName) v Python.Runtime.Runtime.Delegates.GetFunctionByName(String functionName, IntPtr libraryHandle) v Python.Runtime.Runtime.Delegates..cctor() --- Konec trasování zásobníku pro vnitřní výjimku --- v Python.Runtime.Runtime.Delegates.get_Py_IsInitialized() v Python.Runtime.Runtime.Py_IsInitialized() v Python.Runtime.Runtime.Initialize(Boolean initSigs, ShutdownMode mode) v Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv, Boolean initSigs, ShutdownMode mode) v Python.Runtime.PythonEngine.Initialize(Boolean setSysArgv, Boolean initSigs, ShutdownMode mode) v Python.Runtime.PythonEngine.Initialize() v Python.Runtime.Py.GIL() v SkylinesRemotePython.PythonEngine..ctor(ClientHandler client) v SkylinesRemotePython.ClientHandler.HandleClient()
What am I doing wrong?
There are a few key things that I don't understand about pythonnet, which may or may not be connected to this issue. First, do I need to have Python installed on my computer? IronPython apparently works as standalone library, but I don't know how about pythonnet.
Which files do I need to ship with my program?Python.Runtime.dll
,System.Security.AccessControl.dll
,System.Security.Permissions.dll
,System.Security.Principal.Windows.dll
Thanks :)