Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104838
| X-Received | by 10.31.169.130 with SMTP id s124mr18850445vke.1.1457974367229; Mon, 14 Mar 2016 09:52:47 -0700 (PDT) |
|---|---|
| X-Received | by 10.50.111.100 with SMTP id ih4mr298571igb.3.1457974367187; Mon, 14 Mar 2016 09:52:47 -0700 (PDT) |
| Path | csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!y89no7348815qge.0!news-out.google.com!pn7ni9663igb.0!nntp.google.com!av4no572171igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Mon, 14 Mar 2016 09:52:46 -0700 (PDT) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=217.140.111.135; posting-account=apJgMAoAAAChrpW9UQ7Xu2_7vbfdThjW |
| NNTP-Posting-Host | 217.140.111.135 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <db3c8a72-1b47-4460-822d-a1be169d6637@googlegroups.com> (permalink) |
| Subject | Embedding Python into C set up issues |
| From | steven.flolid@gmail.com |
| Injection-Date | Mon, 14 Mar 2016 16:52:47 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Received-Bytes | 2796 |
| X-Received-Body-CRC | 821733767 |
| Xref | csiph.com comp.lang.python:104838 |
Show key headers only | View raw
Good morning!
I have been working with Python for the last few months. I have created a script that I want to embed into a C++ environment, specifically CDT for eclipse. I have read the https://docs.python.org/2/extending/index.html and understand the ideas and differences between the two languages.
However, I am having great trouble getting Py_Initialize() to work in the both CDT and Visual Studio 2015. I have as a starting point a simple C program that prints hello world then calls py_initialize and then prints another line of text to the screen. Calling Py_initialize causes the script to exit with exit code 1. I am at a loss as to why this is happening. I have read the documentation about Py_Initialize() calling exit when it should raise an error so I understand it may be difficult to debug this issue.
Here are the details for my system:
Windows 7 64bit running python 2.7.11 using Visual Studio Community Edition 2015.
Python is installed in the default folder of C:\Python27 and is the only copy of python installed.
Path is has C:\Python27 and C:\Python27\DLLs appended to it in that order.
PYTHONPATH is set to C:\python27lib
In visual studio:
C++/Additional Include Directories has C:\Python27\include appended to it
Linker/Additional Library Directories has C:\Python27\libs appended to it
Linker/Additional Dependencies has python27.lib appended to it
Here is the source code:
#include <Python.h>
#include <stdio.h>
int main() {
printf("hello world");
Py_Initialize();
printf("hello world please");
}
I feel like I must be missing something, I just don't know what it is. Any documentation or help would be much appreciated.
Sincerely,
Steven Flolid
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Embedding Python into C set up issues steven.flolid@gmail.com - 2016-03-14 09:52 -0700 Re: Embedding Python into C set up issues robert.snoeberger@gmail.com - 2016-03-14 18:49 -0700
csiph-web