Re: Python C/API Problem

2009-09-12 Thread Gianfranco Murador
Ok, I solved the previous error changing the second argument , but i
have another question. Does PyNode_Compile function store the object
code in the file passed as argument? And it will be execute by python?
I mean, it works if i type 'python prova.pyc'?
Thank.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python C/API Problem

2009-09-12 Thread Gianfranco Murador
Yes, i've done some debugging and the error is on
PyParser_SimpleParseString(..) call. I'll try to change the second
arguments..
Thank to all.

-- 
http://mail.python.org/mailman/listinfo/python-list


Python C/API Problem

2009-09-11 Thread Gianfranco Murador
Hi to all python fans,
i'm trying to run this C source file:
[code]

#include 
#include 
#include 
#include 
#include 


int main(int argc, char *argv[]) {
Py_Initialize();

struct _node *node = PyParser_SimpleParseString("from time import
time,ctime\n"
"print 'Today 
is',ctime(time())\n",0);
if(node == NULL)
{
printf("Errore nel parsing");
}else{
PyNode_Compile(node, "./prova.pyc");
PyNode_Free(node);
}

Py_Finalize();
return 0;
}

[/code]

I compile the file without errors, but when i launch the executable i
have a Segmentation Fault. I'm using the shared library of python
2.5.2 under linux.. Any ideas? It's clear that i do some mistakes, but
where?
Thanks.
greetings, G.

-- 
http://mail.python.org/mailman/listinfo/python-list