Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'dynamically': 0.07; 'executable': 0.09; 'python': 0.11; 'wrote': 0.14; 'callable': 0.16; 'former,': 0.16; 'latter,': 0.16; 'merely': 0.16; 'process?': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'module': 0.19; 'spread': 0.22; '(or': 0.24; 'script': 0.25; '>': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'program,': 0.31; 'ctypes': 0.31; 'invoke': 0.31; 'received:google.com': 0.35; 'module.': 0.36; 'entry': 0.36; 'process,': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'new': 0.61; 'john': 0.61; 'first': 0.61; 'back': 0.62; 'information': 0.63; 'within': 0.65; '20,': 0.68; 'subject:Old': 0.84; 'subject:needs': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=f4FixFYmSDnD/OeH+DVbK8zlVuMVGxw4KpJAmscu5+Y=; b=E5N3u5lIE6Y/5ljwAF1+MpYKytUuAOm1PF6LVYf4vMJhfSYkY8x03qmt6ceigBJqwR CUrzlDcoyrM5EksbhMeldAqdBsfP8Vh7qF/xnnmaB2itIJMXLbpJ5U6A24cNqrcrXtte 1p1WgY1oPykEYXcLvX+AnhrcDXiu8G68GeS2myRNrXwGVdMLTzad4SSB+L8DhZXlrbz/ jBmcbHmP4YYt8PpLj6AnoepIImIZtiBrrZdTSI9oHyET4hygMmBdghA/H3MzwPNGAnWi iZHTM7eZP4hLh7N6bbj9qFRcN8lNoMVEDXD2hPAbO6sVl8YY4RiLgFQr5kzGnA1jajw2 d72A== X-Received: by 10.70.91.142 with SMTP id ce14mr47663772pdb.138.1419365440045; Tue, 23 Dec 2014 12:10:40 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Tue, 23 Dec 2014 13:09:59 -0700 Subject: Re: Old newbie needs help. To: Python Content-Type: multipart/alternative; boundary=001a11c2141edc469e050ae7c477 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1419365449 news.xs4all.nl 2940 [2001:888:2000:d::a6]:54074 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82852 --001a11c2141edc469e050ae7c477 Content-Type: text/plain; charset=UTF-8 On Sat, Dec 20, 2014 at 9:34 AM, John Culleton wrote: > > This week I wrote my first Python program, a script callable from Scribus, a DTP program. It ran! Now I want to spread my wings a little. How do I call a C language executable subprogram from Python and pass information back and forth? When you say "subprogram", do you mean that you want to start and communicate with a whole new process, or do you merely want to invoke some dynamically loaded entry point within the same process? For the former, use the subprocess module. For the latter, use the ctypes module (or consider using Cython instead of pure Python if Scribus will support it). --001a11c2141edc469e050ae7c477 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Sat, Dec 20, 2014 at 9:34 AM, John Culleton <john@wexfordpress.com> wrote:
&= gt;
> This week I wrote my first Python program, a script callable fr= om Scribus, a DTP program. It ran! Now I want to spread my wings a little. = How do I call a C language executable subprogram from Python and pass infor= mation back and forth?

When you say "subprogram", do = you mean that you want to start and communicate with a whole new process, o= r do you merely want to invoke some dynamically loaded entry point within t= he same process? For the former, use the subprocess module. For the latter,= use the ctypes module (or consider using Cython instead of pure Python if = Scribus will support it).
--001a11c2141edc469e050ae7c477--