FAQ
hi i need help with extending this http://paste.pound-python.org/show/8918/
c code so that it can initiate this python script http://paste.pound-python.org/show/8917/
and export file path here..

btw I tried to run following python code :

#include <python2.3/Python.h> //changed this to python2.7/Python.h
didn't work the I changed it to Python.h
// Error msg : fatal
error: Python.h : no file or directory compilation terminated
//python-dev and
python2.7-dev is already installed.

void process_expression(char* filename,
int num,
char** exp)
{
FILE* exp_file;

// Initialize a global variable for
// display of expression results
PyRun_SimpleString("x = 0");

// Open and execute the file of
// functions to be made available
// to user expressions
exp_file = fopen(filename, "r");
PyRun_SimpleFile(exp_file, exp);

// Iterate through the expressions
// and execute them
while(num--) {
PyRun_SimpleString(*exp++);
PyRun_SimpleString("print x");
}
}

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

if(argc != 3) {
printf("Usage: %s FILENAME EXPRESSION+\n");
return 1;
}
process_expression(argv[1], argc - 1, argv + 2);
return 0;
}


thanks
aregee
Ar

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJul 2, '11 at 6:17p
activeJul 2, '11 at 6:17p
posts1
users1
websitepython.org

1 user in discussion

Aregee: 1 post

People

Translate

site design / logo © 2021 Grokbase