[Python.NET] Encoding while embedding python

Phat Loc phat.loc at gmail.com
Fri Jan 12 16:02:20 EST 2018


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<float> { 1, 2, 3 });
                Console.WriteLine(a.dtype);

                dynamic b = np.array(new List<float> { 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: <http://mail.python.org/pipermail/pythondotnet/attachments/20180112/6096c92f/attachment.html>


More information about the PythonDotNet mailing list