what are PyObject *globals and PyObject *locals ?

Olivier Sessink olivier at olivier.nospam.pk.wau.nl
Thu Feb 24 09:06:46 EST 2005


Hi all,

I want to make a value available to the global namespace of an embedded
python interpreter. Several functions of the Python/C API feature a
PyObject *globals and a PyObject *locals, so my guess is that these can be
used for this purpose. Unfortunately, the Python/C API does not describe
how this works.

If I want for example, to create a variable MyVar that can be read by the
python code in some filename, to be run with PyRun_AnyFile();, how can I
do this?

Or do I misunderstand the API, and can Py_InitModule() register both
functions *and* variables? (and how to register the variable then?)

regards,
	Olivier

(I know extending is the preferred solution, unfortunately I was not aware
of this some years ago)

------------ And now a word from our sponsor ------------------
For a quality usenet news server, try DNEWS, easy to install,
fast, efficient and reliable. For home servers or carrier class
installations with millions of users it will allow you to grow!
----  See http://netwinsite.com/sponsor/sponsor_dnews.htm  ----



More information about the Python-list mailing list