Please, someone tell me what's going wrong here. ;>

Darrell news at dorb.com
Tue Jan 11 20:54:08 EST 2000


Pasted this much into the initModuleName function of an existing extension
module and it worked just fine. Also removed everything before it which
caused it to print the path over and over.

     int a;
     Py_SetProgramName("xyz");
     a=PyRun_SimpleString("import sys"); /* import into the namespace */
     a=PyRun_SimpleString("print sys.path");


--
--Darrell
"Jason Maskell" <backov at nospam.csolve.net> wrote in message
news:ylQe4.55014> > void TForm1::Button1Click(TObject *Sender)
> > {
> >     int a;
> >     Py_SetProgramName(Application->ExeName.c_str());
> >     Py_Initialize();
> >     a=PyRun_SimpleString("import xyzzy"); /* import into the namespace
*/
> >     a=PyRun_SimpleString("xyzzy.foo()");
> >     Py_Finalize();
> > }
> >
> > The module never got imported into the __main__ module, only
> > initialized.
>






More information about the Python-list mailing list