From: "Rego, P." <pvrego@gmail.com>
Subject: Re: Running a simple Python from Ada program
Date: Fri, 3 Apr 2020 12:19:44 -0700 (PDT)
Date: 2020-04-03T12:19:44-07:00 [thread overview]
Message-ID: <e1993dba-8fa0-4dcf-85cb-63625c704fe6@googlegroups.com> (raw)
In-Reply-To: <d067dcb5-a763-48e0-a142-af8446f2184e@googlegroups.com>
> > Do not do that. There exist Python C API, which you should use:
> > https://docs.python.org/3/c-api/index.html
> You mean that the problem is with the Python "print" ?
I tested with a very simple C code. If the Python print is blocked, it should be blocked also from a C call, I presume (ok someone will contest, anyway). Any case, from the C call, it does not block.
So I will try to simplify a bit the question. I want to do the equivalent of this
#include <stdio.h>
#include <stdlib.h>
int main(){
system("python testpy.py ddddd");
return 0;
}
In this case it does not block the testpy.py printouts.
But I am doing this
with Interfaces.C; use Interfaces.C;
procedure systest2 is
function Sys (Arg : Char_Array) return Integer;
pragma Import(C, Sys, "system");
Ret_Val : Integer;
begin
Ret_Val := Sys(To_C("python testpy.py arg1 arg2"));
end systest2;
which blocks the testpy.py script until its end. This should not happen. So, please, how could I fix this?
next prev parent reply other threads:[~2020-04-03 19:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-03 16:57 Running a simple Python from Ada program Rego, P.
2020-04-03 17:35 ` Dmitry A. Kazakov
2020-04-03 19:05 ` Rego, P.
2020-04-03 19:19 ` Rego, P. [this message]
2020-04-03 20:06 ` Dmitry A. Kazakov
2020-04-04 1:48 ` Dennis Lee Bieber
2020-04-03 23:49 ` Mikhail Terekhov
2020-04-04 2:55 ` Nasser M. Abbasi
2020-04-04 8:15 ` Dmitry A. Kazakov
2020-04-04 10:44 ` fabien.chouteau
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox