Two questions on embedding :)

Gordon McMillan gmcm at hypernet.com
Thu Jun 1 21:52:50 EDT 2000


Stephen Hansen <stephen at cerebralmaelstrom.com> wrote:
[importing modules from C]
>I tried about a dozen different combinations of commands and so 
on and so
>forth until I just gave up and did PyRun_SimpleString("import 
sys");.
>
>    Does anyone have an example program anywhere that 
incorporates importing
>modules in a C++ level? Hrm. Actually, is there a need to bother? 
Is it any
>better then just doing a PyRun_SimpleString?

Not really. You're just mucking with the environment, not trying to 
return a result....

>    Later, I basicaly wanted to call: 
"languages.Translate('name','string')"
>and have the result returned to the C program for processing. 

Now you're better off diving in and getting your paws on the 
languages module, then the Translate function and calling it 
directly.

Check out
http://www.mcmillan-inc.com/embed.html 
and it's follow on page for examples (of both, actually).

- Gordon




More information about the Python-list mailing list