Embedded Python implementation

Chris Liechti cliechti at gmx.net
Sat Sep 7 09:14:44 EDT 2002


Evan <tagith1394 at hotmail.com> wrote in 
news:MAfe9.266658$v53.14092531 at news3.calgary.shaw.ca:

> Hello,
> 
> I am currently trying to embed Python in an application I am writing, 
> and all is going well, except for one inexplicable bug..
> 
> When I pass a variable (pointer to a string) to PyRun_String, it will 
> always error on line 2, character 5.. regardless of what is actually on 
> the line in that spot (for that matter, even if there is no line 2)..

that sounds as you woul not pass the pointer to a string but to something 
else...

> The script works perfectly when I place it in a file, and use 
> PyRun_File, and it also works perfectly when I place the string in 
> quotations, and pass it to PyRun_String directly inside the C code..
> 
> The C code in question is as follows:
> if ( PyRun_String( com_list, Py_file_input, pGlobals, pLocals ) == NULL )
>          PyErr_Print();

i think that sould work when com_list is a "char *", say:
char * com_list = "print hello\n";
 
> I am confident the problem is not with pGlobals or pLocals, as those 
> arguments are used with PyRun_File, as well as with the quoted string..

chris
-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list