473,226 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 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 1199

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Phil Frost | last post by:
Greetings all. I'm attempting to embed a python interpreter at a very low level in an OS I am writing. Currently I'm stuck with build issues. Firstly, as there is no working C compiler in our OS, I...
by: Robey Holderith | last post by:
Anyone know a good way to embed python within python? Now before you tell me that's silly, let me explain what I'd like to do. I'd like to allow user-defined scriptable objects. I'd like to...
by: Craig Ringer | last post by:
Hi folks I'm a bit of a newbie here, though I've tried to appropriately research this issue before posting. I've found a lot of questions, a few answers that don't really answer quite what I'm...
by: Carl Waldbieser | last post by:
Has anyone had any experience embedding a CPython engine in a .NET application? In the COM/ActiveX world, it was pretty easy to use Mark Hammond's win32 modules to create a script engine component...
by: Andrew Trevorrow | last post by:
No response to my last message, so I'll try a different tack... Does anyone know of, or even better, has anyone here written a C++ application for Mac/Windows that allows users to run Python...
by: mrstephengross | last post by:
Ok, I'm trying to build libpython.a. It's version 1.5.2 (I know it's an old version, but I need to get it to work if at all possible). I want to find a way to make sure the module copy_reg is...
by: Avi Kak | last post by:
Folks, Does regular expression processing in Python allow for executable code to be embedded inside a regular expression? For example, in Perl the following two statements $regex =...
by: dmoore | last post by:
Hi Folks: I have a question about the use of static members in Python/C extensions. Take the simple example from the "Extending and Embedding the Python Interpreter" docs: A simple module...
by: jens.hester | last post by:
Hi experts, I am currently embedding the Python interpreter 2.3.4 in a managed C++ application (I currently use an unmanaged dll which is linked to Python23.lib). Forget about Ironpython - no...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...

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.