From phat.loc at gmail.com Fri Jan 12 16:02:20 2018 From: phat.loc at gmail.com (Phat Loc) Date: Fri, 12 Jan 2018 16:02:20 -0500 Subject: [Python.NET] Encoding while embedding python Message-ID: Hi All, I tried the example of embedding python inside a clr application. using (Py.GIL()) { dynamic np = Py.Import("numpy"); Console.WriteLine(np.cos(np.pi * 2)); dynamic sin = np.sin; Console.WriteLine(sin(5)); double c = np.cos(5) + sin(5); Console.WriteLine(c); dynamic a = np.array(new List { 1, 2, 3 }); Console.WriteLine(a.dtype); dynamic b = np.array(new List { 6, 5, 4 }, dtype: np.int32); Console.WriteLine(b.dtype); Console.WriteLine(a * b); Console.ReadKey(); } However the output I get is all scrambled ?0? ???????3 ? ? -0.675262089199912 ???4?ty ??24? ???????? ? Is there some encoding settings that I need to set somewhere? Thanks, Phat -------------- next part -------------- An HTML attachment was scrubbed... URL: From phat.loc at gmail.com Tue Jan 16 13:53:49 2018 From: phat.loc at gmail.com (Phat Loc) Date: Tue, 16 Jan 2018 18:53:49 +0000 Subject: [Python.NET] Runtime.Py_Main from within a Windows application Message-ID: Hello, Is it possible to create a python repl from within a Windows application. I know it is possible from a Windows console application. However everytime I run Runtime.Py_Main from within a WPF app it just exits. Any suggestions on how to get an interactive version working or troubleshoot why it Runtime.Py_Main just exits with code 0? Thanks, Phat -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Tue Jan 16 22:59:07 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Wed, 17 Jan 2018 03:59:07 +0000 Subject: [Python.NET] Runtime.Py_Main from within a Windows application In-Reply-To: References: Message-ID: Can you post a code sample? You need to set the STA threading like in this demo: https://github.com/pythonnet/pythonnet/blob/master/demo/DynamicGrid.py On Tue, Jan 16, 2018, 1:35 PM Phat Loc wrote: > Hello, > > Is it possible to create a python repl from within a Windows application. > I know it is possible from a Windows console application. However everytime > I run Runtime.Py_Main from within a WPF app it just exits. Any suggestions > on how to get an interactive version working or troubleshoot why > it Runtime.Py_Main just exits with code 0? > > Thanks, > > Phat > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: