simple? embedding question

sndive at gmail.com sndive at gmail.com
Tue Oct 30 19:31:03 CET 2007


suppose i have imported two modules foo and bar with
foo=PyImport_ImportModule("foo") and bar=PyImport_ImportModule("bar")
respectively.

Now suppose I have an artitrary python expression to evaluate.
Do I need to parse that thring and check for foo. and bar. before
jumping the usual
PyModule_GetDict,PyDict_GetItemString,PyObject_CallObject hoop hoop on
the PyObject for
the prefix or there is a better way?

btw PyRun_SimpleString("foo.baz()"); does not work:
 Traceback (most recent call last):
  File "<string>", line 1, in ?
NameError: name 'foo' is not defined

and i potentially need a PyObject* back with the result of the
expression anyway.




More information about the Python-list mailing list