Hello,
I am using the 2.3 release branch.
I have C# code like this:
public class A {
public A() {...}
}
public class B {
public B() {...}
public static void Func(IEnumerable<A> input){
}
}
I want to pass in a python list to Func but get this error:
>>> b=B()
>>> b.Func([A(), A()])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: No method matches given arguments
I tried …
[View More]both IEnumerable and IList in the signature of 'Func'. I know that
I can import System and create some .NET collection type and it works well.
Did I miss anything? Is this usage pattern within the design goals of
pythonnet? I assume this would have to be fixed in MethodBinder but I
wanted to try asking here first.
Thanks!
Mohamed Koubaa
[View Less]
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?
…
[View More]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.
[View Less]
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 > …
[View More]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
[View Less]
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 > …
[View More]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
[View Less]