delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/28/15:34:44

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.6 required=5.0 tests=BAYES_50,J_CHICKENPOX_43
X-Spam-Check-By: sourceware.org
Message-ID: <20090428133426.9d21hfl24g08socw@www.cs.uregina.ca>
Date: Tue, 28 Apr 2009 13:34:26 -0600
From: bailey2r AT cs DOT uregina DOT ca
To: cygwin AT cygwin DOT com
Subject: problems with embedded python on cygwin.
MIME-Version: 1.0
User-Agent: Internet Messaging Program (IMP) H3 (4.1.5)
X-Authenticated-User: bailey2r AT cs DOT uregina DOT ca
X-Connect-Host: mercury.cs.uregina.ca
X-Connect-IP: 142.3.200.53
X-Envelope-From: <bailey2r AT cs DOT uregina DOT ca>
X-Sender-MX: hermes2.cs.uregina.ca [142.3.150.153]
X-Sender-MX: mercury2.cs.uregina.ca [142.3.200.153]
X-Virus-Scan: Virus Scanned by CSAVMilter v3.3
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

First, I've read about the _socket problem in cygwin and am assuming=20=20
that in the latest python 2.5.2 or cygwin this problem has been=20=20
solved?  I can import _socket just fine in the intereactive=20=20
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 =3D 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=20=20
illegal operation window.

I compile it by using:

gcc -Wall -IC:/cygwin/usr/include/python2.5=20=20
-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=20=20
import cgi. So I assume if I'm going to make something meaning (using=20=20
_socket) in cygwin i need to use the cygwin install of python.  Does=20=20
anyone have any idea as to why it crashes like this?  Or can point me=20=20
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019