Embedded Python in a C++ CGI
J. Papa
jpapa at websense.com
Mon Aug 6 13:57:58 EDT 2001
I am attempting to use embedded python in a cgi program. (I know it's
strange, but humor me.) However, text pumped to "print" is not
redirected to the client.
What exactly is the problem with this code?
#include "Python.h"
#include <iostream>
using namespace std;
char *pszCgi = "print \"Content-Type: text/html\\r\\n\\r\\n\"\n" \
"print \"Hello Word!\"\n";
int main(int argc, char* argv[])
{
Py_Initialize();
PyRun_SimpleString( pszCgi );
// cout << "Content-Type: text/html\r\n";
// cout << "\r\n";
// cout << "Hello World!" << endl;
return 0;
}
If I comment out the Py_ stuff and uncomment the cout stuff it works
fine.
Thanks,
jpapa
More information about the Python-list
mailing list