Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104902

Re: Embedding Python into C set up issues

Newsgroups comp.lang.python
Date 2016-03-14 18:49 -0700
References <db3c8a72-1b47-4460-822d-a1be169d6637@googlegroups.com>
Message-ID <78237132-5751-458d-9042-e14977da087f@googlegroups.com> (permalink)
Subject Re: Embedding Python into C set up issues
From robert.snoeberger@gmail.com

Show all headers | View raw


> 
> 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.
> 

The documentation for Py_Initialize says, "There is no return value; it is a fatal error if the initialization fails." Initialization is failing in your C program, probably because it isn't able to locate a module needed for startup, such as site or encodings.

Py_Initialize doc: https://docs.python.org/2/c-api/init.html#c.Py_Initialize

You probably need to specify the "home" directory, either with the environment variable PYTHONHOME or with Py_SetPythonHome. For your system, the directory should be C:\Python27.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


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