Ah, cheers.
On 5 Jul 2013 08:16, "Tony Roberts" <tony(a)pyxll.com> wrote:
> Anywhere on your pythonpath should do. If you use the setupwin.py from my
> github fork you should just be able to do 'python setupwin.py install' to
> put it in your site-packages (best to use virtualenv if you do that).
>
> Tony.
>
>
> On Fri, Jul 5, 2013 at 4:10 PM, Kyle Rocha <kyle.rocha(a)gmail.com> wrote:
>
>> That's odd, I'll have to just keep trying. Thanks for getting most of the
>> legwork done on 3.x.
>>
>> There must be something else I'm missing. Where are you supposed to put
>> the dll?
>>
>> / kyle
>> On 5 Jul 2013 07:01, "Tony Roberts" <tony(a)pyxll.com> wrote:
>>
>>> Yes, I made some changes to get it working in Python 3 a while ago. The
>>> code's on github: https://github.com/tonyroberts/pythonnet.
>>>
>>> I've tested it with 3.3 x64 and it works ok for me (although I've only
>>> really used the 3.2 x64 build extensively).
>>>
>>> regards,
>>> Tony
>>>
>>>
>>> On Fri, Jul 5, 2013 at 3:56 AM, Kyle Rocha <kyle.rocha(a)gmail.com> wrote:
>>>
>>>> Has anyone tried this in a 64bit process with Python 3.3?
>>>>
>>>> I've been trying to get it to run but I can't seem to get past
>>>> "dynamic module does not define init function CLR_init" or something
>>>> to that effect.
>>>> _________________________________________________
>>>> Python.NET mailing list - PythonDotNet(a)python.org
>>>> http://mail.python.org/mailman/listinfo/pythondotnet
>>>>
>>>
>>>
>
Hi,
Just thought I'd send a heads up to say I've made some modifications to
python.net to make it much more convenient to call python code from C#,
which can be found here: http://github.com/patstew/pythonnet
I've inherited PyObject from DynamicObject, wired up the appropriate bits
and added a few convenience functions, so now you can write C# code like
this:
static void Main(string[] args)
{
using (Py.GIL()) {
dynamic np = Py.Import("numpy");
dynamic sin = np.sin;
Console.WriteLine(np.cos(np.pi*2));
Console.WriteLine(sin(5));
Console.WriteLine(np.cos(5) + sin(5));
dynamic a = np.array(new List<float> { 1, 2, 3 };
dynamic b = np.array(new List<float> { 6, 5, 4 }, Py.kw("dtype",
np.int32)); Console.WriteLine(a.dtype);
Console.WriteLine(b.dtype);
Console.WriteLine(a * b);
Console.ReadKey();
}
}
which outputs:
1.0
-0.958924274663
-0.6752620892
float64
int32
[ 6. 10. 12.]
as you might expect. You can call, access members and perform mathematical
operations all as normal. Managed arguments are automatically converted to
python types when used with a python function, and mathematical operations
like multiplying numpy arrays happen entirely within python. You can
specify keyword arguments using Py.kw("key1", value1, "key2", value2, ....)
as an extra argument to the function. One slight annoyance is that np.pi*2
works while 2*np.pi doesn't, due to limitations of DynamicObject.
This is just a first shot, and I haven't actually used it much yet, so
there are almost certainly bugs, leaked references, etc lurking. I'll
probably keep adding to it in the near future. Hope it's useful to someone.
Cheers,
Patrick
Has anyone tried this in a 64bit process with Python 3.3?
I've been trying to get it to run but I can't seem to get past
"dynamic module does not define init function CLR_init" or something
to that effect.