From viktoria.kovecses at imaginary-spaces.com Thu Aug 2 10:38:31 2018 From: viktoria.kovecses at imaginary-spaces.com (Viktoria Kovecses) Date: Thu, 2 Aug 2018 10:38:31 -0400 Subject: [Python.NET] Python.Net crash on assembly reload in Unity Message-ID: Hello, We are experiencing crashes when running Python.Net in the Unity 2018.2 game engine. Specifically, after modifying a C# script in Unity, an automatic reload is triggered which results in a crash in Py_Finalize. Here are the repro steps: 0. Make sure to call PythonEngine.Shutdown on domain unload (otherwise it crashes earlier). 1. Create a Unity project and add the compiled Python.Net files (clr.pyd and Python.Runtime.dll) to the Assets folder 2. In Unity Player Settings (Edit > Project Settings > Player), under "Other Settings", make sure "Api Compatibility Level" is set to ".NET 4.x", and "Scripting Runtime Version" is set to ".NET 4.x Equivalent" 3. In Assets, create the following C# script (HelloWorld.cs): ``` using UnityEditor; using UnityEngine; using Python.Runtime; class HelloWorld { [MenuItem("Python/Hello")] public static void CallHello() { using (Py.GIL()) { string script = "import clr\n" + "clr.AddReference('UnityEngine.dll')\n" + "import UnityEngine\n" + "UnityEngine.Debug.Log('hello world!')\n"; PythonEngine.Exec(script); } } } ``` 4. Run the script by selecting Python > Hello from the top menu --> This will log "hello world!" to the Unity console 5. Modify HelloWorld.cs script: change Hello to Hello 1 and trigger hot reloading of assemblies 6. run Python > Hello 1 --> Logs in the console 7. Modify HelloWorld.cs script: change Hello 1 to Hello 2: --> crash in dict_traverse (garbage collection during Py_Finalize). Does anyone know what could be causing the crash and/or how to fix it? Any help is appreciated. Thank you, Viktoria -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lassonde at imaginary-spaces.com Thu Aug 9 14:46:40 2018 From: david.lassonde at imaginary-spaces.com (David Lassonde) Date: Thu, 9 Aug 2018 14:46:40 -0400 Subject: [Python.NET] Python.Net crash on assembly reload in Unity In-Reply-To: References: Message-ID: Hi Viktoria, As you know, I am working on fixes for these Domain Unload / Reload crashes. I opened an issue against the public repo for the first crash (on second init) here: https://github.com/pythonnet/pythonnet/issues/714 I will do the same for the second crash (on second domain unload) when the fix is approved in our own fork Cheers! David On Mon, Jul 30, 2018 at 1:02 PM, Viktoria Kovecses < viktoria.kovecses at imaginary-spaces.com> wrote: > Hello, > > We are experiencing crashes when running Python.Net in the Unity 2018.2 > game engine. Specifically, after modifying a C# script in Unity, an > automatic reload is triggered which results in a crash in Py_Finalize. > > Here are the repro steps: > 0. Make sure to call PythonEngine.Shutdown on domain unload (otherwise it > crashes earlier). > 1. Create a Unity project and add the compiled Python.Net files (clr.pyd > and Python.Runtime.dll) to the Assets folder > 2. In Unity Player Settings (Edit > Project Settings > Player), under > "Other Settings", make sure "Api Compatibility Level" is set to ".NET 4.x", > and "Scripting Runtime Version" is set to ".NET 4.x Equivalent" > 3. In Assets, create the following C# script (HelloWorld.cs): > > ``` > using UnityEditor; > using UnityEngine; > using Python.Runtime; > > class HelloWorld > { > [MenuItem("Python/Hello")] > public static void CallHello() > { > using (Py.GIL()) > { > string script = "import clr\n" + > "clr.AddReference('UnityEngine.dll')\n" + > "import UnityEngine\n" + > "UnityEngine.Debug.Log('hello world!')\n"; > > PythonEngine.Exec(script); > } > } > } > ``` > > 4. Run the script by selecting Python > Hello from the top menu > --> This will log "hello world!" to the Unity console > > 5. Modify HelloWorld.cs script: change Hello to Hello 1 and trigger hot > reloading of assemblies > 6. run Python > Hello 1 > --> Logs in the console > > 7. Modify HelloWorld.cs script: change Hello 1 to Hello 2: > --> crash in dict_traverse (garbage collection during Py_Finalize). > > Does anyone know what could be causing the crash and/or how to fix it? > > Any help is appreciated. > > Thank you, > Viktoria > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brice.thurin at buhlergroup.com Fri Aug 24 09:13:28 2018 From: brice.thurin at buhlergroup.com (brice.thurin at buhlergroup.com) Date: Fri, 24 Aug 2018 13:13:28 +0000 Subject: [Python.NET] Passing System Pointer as Byte* Message-ID: Good Afternoon, I have a class from a third party DLL with the following Buffer.Attach method: public void Attach( byte* aBuffer, uint aSize) The method can be called from C# using: aBuffer.Attach( (byte*) arrPointer , nBytes) where arrPointer is a System.Reflection.Pointer How can I call the method using Python.Net. If I pass only the arrPointer to the method I receive a TypeError: No method matches given arguments. In other word, how can I perform the type casting in python? Thank you in advance for any help. Best Regards, Brice ________________________________ This e-mail (including any attachments) is confidential, may be legally privileged and is designated exclusively for the intended recipient. If you are not the intended recipient, please immediately delete this e-mail and notify the sender by phone or by e-mail. We process personal data in accordance with our privacy policy available at: www.buhlergroup.com/privacy. -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Thu Aug 30 22:30:40 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Thu, 30 Aug 2018 21:30:40 -0500 Subject: [Python.NET] Looking for experts in msbuild/nuget Message-ID: We are having some pythonnet build issues on Travis CI with Mono. Here is a bounty I opened on stackoverflow, if someone knows how to solve this error: https://stackoverflow.com/questions/51988395/build-failures-with-mono-5-14-0-177-msbuild-15-0-nuget-4-7-1-on-travis-ci-but -------------- next part -------------- An HTML attachment was scrubbed... URL: