From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a37:bf05:: with SMTP id p5mr9599064qkf.344.1585933035616; Fri, 03 Apr 2020 09:57:15 -0700 (PDT) X-Received: by 2002:a05:6830:148d:: with SMTP id s13mr7071710otq.342.1585933035128; Fri, 03 Apr 2020 09:57:15 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 3 Apr 2020 09:57:14 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=179.35.31.165; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu NNTP-Posting-Host: 179.35.31.165 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Running a simple Python from Ada program From: "Rego, P." Injection-Date: Fri, 03 Apr 2020 16:57:15 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:58299 Date: 2020-04-03T09:57:14-07:00 List-Id: Does someone would have a simplest as possible way to run a Python script from the Ada project? The Python script in this case only has a print in a loop, with a sleep, so each iteration it should print the arguments. The Python script I'm using is import sys import time for index in range(10): print(sys.argv) time.sleep(1) On approach I am trying is running this one as a batch script, so using import sys import time with Text_IO; 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; The problem is that the execution blocks the script, meaning that the Python printouts are only printed at the end of the execution, at once. I know that there is a solution (to run Python from Ada) based on GNATCOLL, but I couldn't find any example to run it. Tnx