By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 777 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Embedding: Question about modules

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.