matplotlibD returns

Brett Brett at
Tue Sep 17 16:50:52 UTC 2019

On Tuesday, 17 September 2019 at 15:21:37 UTC, jmh530 wrote:
> On Tuesday, 17 September 2019 at 01:54:01 UTC, Brett wrote:
>> How does one get return values?
>> Shows that python uses return values to set properties of the 
>> plot
>> Does not give any examples of return values and when trying 
>> gives error about void returns.
> If I'm reading the following comment [1] correctly, this 
> feature may require changes to matplotlib-d to implement.
> [1] 

That was over 2 years ago, it seems he isn't interested in making 
it work. In his code he uses pipes...

void call(string py_script) {
     import std.process: environment, pipeProcess, wait, Redirect;

     auto py_path =  environment.get("MATPLOTLIB_D_PYTHON", 
	py_path = `python.exe`;
     auto pipes = pipeProcess(py_path, Redirect.stdin | 


     auto result = wait(;

     if (result != 0) {
         string error;
         foreach (line; pipes.stderr.byLine)
             error ~= line ~ "\n";
         throw new Exception("\n\nERROR occurred in Python:\n" ~ 

Not sure if this can be modified to work with returns? I guess 
they could be exported through json and possible read and used?
I don't see how it could work though since it seems that pointers 
will be returned. I don't know enough about python to know if 
some mechanism would work.

Maybe some python code could be created to call D and pass info 
back and forth or some better interprocess communications can be 

He's essentially just send commands through text(py_script) that 
are executed on the python side of things. Nothing ever really 
takes place in D.

I guess a return type could could done on the python side too but 
it would require modifying the code and would be overly complex.

More information about the Digitalmars-d-learn mailing list