is there a way to embed python 3.7 code in D program?

Cym13 cpicard at purrfect.fr
Mon May 13 06:04:57 UTC 2019


On Sunday, 12 May 2019 at 20:06:34 UTC, torea wrote:
> Hi,
>
> I'd like to use D for the "brain" of a small robot (Anki 
> vector) whose API is coded in Python 3.6+.
> I had a look at Pyd but it's limited to python 2.7...
> Would there be other ways to call python functions and retrieve 
> the python objects (including camera image) inside a D program?
>
> Best regards

If pyd doesn't work you still have the option to use python's C 
interfaces (it has many). Write your D program normally, provide 
extern(C) functions as an interface and have python call those. 
There are some caveats but lots of resources exist on calling C 
from python and calling D from C. I haven't checked but it's also 
probable that this is how pyd does it, have a look if you want to 
reproduce its functionalities.

Pyd is easier to use, but it's not the only way.


More information about the Digitalmars-d-learn mailing list