469,267 Members | 922 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

Embedding: Question about modules

Hi All,

A question about embedding:

If I take the example code on embedding (Section 5.3 of Extending and
Embedding the Python Interpreter 2.4) and add the lines:

PyRun_SimpleString("import sys");
PyRun_SimpleString("print globals()");

Just after the part where the code loads the module, and then I have a
script that looks like:

# mod_test.py
def foo(x):
for g in globals():
print g

The first printout of the globals shows the sys module, but the second
one does not. Can someone explain why this is ? And how do I make the
sys module accessible to the module I load (as per the 5.3 example).
TIA,
smilechaser

Jul 18 '05 #1
0 1016

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Phil Frost | last post: by
23 posts views Thread by Robey Holderith | last post: by
1 post views Thread by Carl Waldbieser | last post: by
10 posts views Thread by Andrew Trevorrow | last post: by
reply views Thread by mrstephengross | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.