This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problems with embedded python on cygwin.


First, I've read about the _socket problem in cygwin and am assuming that in the latest python 2.5.2 or cygwin this problem has been solved? I can import _socket just fine in the intereactive interpreter in cygwin; the problem is embedding python into C code.

I have a C program:

#include <Python.h>
#include <math.h>
#include <stdio.h>

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

  //FILE *fp = fopen ("a2.py",   "r+");
  //PyRun_SimpleFile(fp, "a2.py");

  PyRun_SimpleString("from time import time, ctime\n"
                     "print 'Today is',ctime(time())\n");
  PyRun_SimpleString("import sys\n"
                     "print sys.path\n"
					 "import cgi");
  //PyRun_SimpleString("import a2\n");
  Py_Finalize();
  return 0;
}


which crashes when I run it in cygwin. It merely crashes; i get the illegal operation window.


I compile it by using:

gcc -Wall -IC:/cygwin/usr/include/python2.5 -LC:/cygwin/usr/lib/python2.5/config embed.c -lpython2.5 -lm

It compiles just fine. I just get the runtime crash.

Oddly, when I use the windows install of python that i have:

gcc -Wall -IC:/Python26/include -LC:/Python26/libs embed.c -lpython26 -lm

It works fine. Problem is that I get the _socket issue if I try to import cgi. So I assume if I'm going to make something meaning (using _socket) in cygwin i need to use the cygwin install of python. Does anyone have any idea as to why it crashes like this? Or can point me in the right direction? thanks.

~robert

-----------------------------------------------------
This e-mail was sent via the Secure Web Server at the
University of Regina,  Department of Computer Science
         https://www.cs.uregina.ca/WebMail/




-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]