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]
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]
Hi pythonnet team,
I followed your tutorials ( https://github.com/pythonnet/
pythonnet/wiki/Various-debugging-scenarios-of-embedded-CPython) and I could
test two out of three scenarios (I couldn't get ptvsd to work).
When I tested it on Lean, I've verified that we don't get much information
with the mixed-mode cross-language debugger, so I extended your example
with a mock Lean algorithm:
https://github.com/QuantConnect/pythonnet/tree/debug
First scenario - mixed-mode cross-language debugger …
[View More](attached file:
mixeddebugger.png):
The debugger doesn't give us the information about the object if we
click/mounse over on it or inspect it in Locals/Watch. We need to know what
attributes it has to access them in "Immediate Window".
Second scenario - python debugger (attached file: pythondebugger.png):
The debugger does show the information.
The issue with the python debugger is that as we are using threads in Lean,
we need to detach and reattach on every iteration in this code snippet the
emulates the OnData call:
Task.Factory.StartNew(() =>
{
algorithm.Run();
}).ContinueWith((ant) =>
{
algorithm.Initialize();
}).ContinueWith((ant) =>
{
algorithm.OnData(DateTime.UtcNow.ToString());
algorithm.OnData(DateTime.UtcNow.ToString());
algorithm.OnData(DateTime.UtcNow.ToString());
}).Wait();
I have tried to attach the debugger in different places in the python
script. If I call it in module level, breakpoints are never hit in the
algorithm. If I call it in Initialize, only breakpoints in Initialize are
hit. And finally, if I call it in OnData, I need to detach and reattach on
every OnData call from the block above.
Best regards,
Alex
On Wed, Jul 25, 2018 at 12:13 AM, Denis Akhiyarov <denis.akhiyarov(a)gmail.com
> wrote:
> I wrote a debugging tutorial using PTVS here and further improvements are
> welcome!
>
> https://github.com/pythonnet/pythonnet/wiki/Various-debuggin
> g-scenarios-of-embedded-CPython
>
>
> On Tue, Jul 10, 2018, 2:13 AM Jared Broad via PythonDotNet <
> pythondotnet(a)python.org> wrote:
>
>> Hello PythonNet
>>
>> Do you have any tips/experiences/tools for allowing debugging for a
>> C#-pythonnet script?
>>
>> Thank you
>> Jared
>>
>> --
>> Jared Broad
>>
>> www.quantconnect.com
>> Phone-USA: +1 917 327 0556
>> *Democratizing Finance, Empowering Individuals*
>> Facebook <http://www.facebook.com/QuantConnect> | Twitter
>> <https://twitter.com/#!/QuantConnect> | LinkedIn
>> <http://www.linkedin.com/company/quantconnect> | Skype: jaredbroad
>>
>> We're recruiting! Join us and make your mark on the future of finance
>> <https://www.quantconnect.com/jobs>
>> _________________________________________________
>> Python.NET mailing list - PythonDotNet(a)python.org
>> https://mail.python.org/mailman/listinfo/pythondotnet
>>
>
[View Less]
hello,there are something with my computer,I need your help
when i run setup.py ,there are always CSC ,but i don't know how to deal with it
thank you .
发自网易邮箱大师