471,624 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

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).

Jul 18 '05 #1
0 1097

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
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.