Injecting a C side object into the local dict

Discussion in 'Python' started by Jamie R. Parent, Feb 11, 2005.

  1. Hello,

    How do you go about taking a variable which was declared in C and pass
    that through to a Python script? I have tried doing this by adding a
    simple string which is a PyObject from C into the local dictionary and
    retrieving it from script via a locals()["myCvar"] print statement.
    This however does not seem to work. It would seem that when the scripts
    are ran the local dictionary with the added item is wiped clean and a
    new local dictionary is instead used. Any direction or help would be
    appreciated.

    Cheers,
    Jamie.
    Jamie R. Parent, Feb 11, 2005
    #1
    1. Advertising

  2. Jamie R. Parent

    python Guest

    Take a look at Pyrex.


    <http://nz.cosc.canterbury.ac.nz/~greg/python/Pyrex/>

    More at

    <http://www-106.ibm.com/developerworks/library/l-cppyrex.html>


    /Jean Brouwers


    Jamie R. Parent wrote:
    > Hello,
    >
    > How do you go about taking a variable which was declared in C and

    pass
    > that through to a Python script? I have tried doing this by adding a
    > simple string which is a PyObject from C into the local dictionary

    and
    > retrieving it from script via a locals()["myCvar"] print statement.
    > This however does not seem to work. It would seem that when the

    scripts
    > are ran the local dictionary with the added item is wiped clean and a
    > new local dictionary is instead used. Any direction or help would be
    > appreciated.
    >
    > Cheers,
    > Jamie.
    python, Feb 11, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. amine  zejli
    Replies:
    1
    Views:
    412
    Tom Yates
    Oct 20, 2003
  2. amine  zejli
    Replies:
    0
    Views:
    388
    amine zejli
    Oct 19, 2003
  3. Amine Zejli
    Replies:
    1
    Views:
    424
    William Ryan
    Oct 19, 2003
  4. Brian W
    Replies:
    10
    Views:
    763
    Brian W
    Jul 2, 2003
  5. tai
    Replies:
    6
    Views:
    182
    Bart Lateur
    Nov 19, 2006
Loading...

Share This Page