Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83372

Re: exporting c_variable to embedded python module

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:module': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; 'builtins.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'module?': 0.16; 'parameter.': 0.16; 'side.': 0.16; 'top-level': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'import': 0.22; 'cc:addr:python.org': 0.22; 'module,': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'pass': 0.26; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'linux.': 0.31; 'another': 0.32; 'running': 0.33; 'fri,': 0.33; 'sense': 0.34; 'maybe': 0.34; 'something': 0.35; 'done.': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'c++': 0.36; 'so,': 0.37; 'question,': 0.38; 'anything': 0.39; 'does': 0.39; 'how': 0.40; 'even': 0.60; 'first': 0.61; '2015': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=6Rzv+zhMV5S25xgRvEn9MsbmGVhSEnhGzrkZ93GSuu0=; b=qqtlMR9KLVFz5LfVf8X38AP1khE//IKLxawKcitstqCz+B4a6IINjZdSQP9bpj/m6Q Sg+VNHIFaRu3OgjLwZhMZInbLWDiggtA8GsW4cpGrY44y80c5koTslXAVlLi/RAjLm4b trawUu+Cf9P/Z5sr3sQtCSkVwIQmWFfp1abzSwjH6Nr702ZWdGZyrdmuK/GJ4kNa3KW8 8Ff7JSVG2A3gbDYSQ+wJ0kmAiH7/g8Rqkenjzpr7g7KMEUDAoUOLdNPags6q4ThRY7CL K72MZP3asd93VxnxIMIeWMHAZpcig8kGlFLRDVGx/lRInu/nfvsf9EtiVdwL3n974o0T DKJA==
MIME-Version 1.0
X-Received by 10.50.134.195 with SMTP id pm3mr593602igb.0.1420760846809; Thu, 08 Jan 2015 15:47:26 -0800 (PST)
In-Reply-To <ec235ae5-d926-4747-9a8f-2952956a2494@googlegroups.com>
References <ec235ae5-d926-4747-9a8f-2952956a2494@googlegroups.com>
Date Fri, 9 Jan 2015 10:47:26 +1100
Subject Re: exporting c_variable to embedded python module
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17486.1420760852.18130.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420760852 news.xs4all.nl 2951 [2001:888:2000:d::a6]:56350
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83372

Show key headers only | View raw


On Fri, Jan 9, 2015 at 8:03 AM,  <kenakahn@gmail.com> wrote:
> I'm running a python script loaded via PyImport_Import in my C++ program on Linux.  Is there any way I can pass a value from the c-code to the loaded python module?

To answer this question, first think about how you would like to see
that value on the Python side. Does your C code call a function in
that module? If so, it can pass it a parameter. Or do you want the
top-level import to be aware of something? It might be best to put
something into another module, maybe even builtins. What makes sense
from the Python end? Pretty much anything can be done.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

exporting c_variable to embedded python module kenakahn@gmail.com - 2015-01-08 13:03 -0800
  Re: exporting c_variable to embedded python module Chris Angelico <rosuav@gmail.com> - 2015-01-09 10:47 +1100
  Re: exporting c_variable to embedded python module kenakahn@gmail.com - 2015-01-08 18:16 -0800

csiph-web