Py_Initialize() fails on windows when SDL.h is included.

Nathan Coulson conathan at gmail.com
Tue Mar 15 04:48:04 EDT 2011


I began porting one of my projects from linux (no problems under
linux) to windows,  but I am getting the following problem when
attempting to run it  (This was within gdb)

warning: Fatal Python error:
warning: Py_Initialize: can't initialize sys standard streams
warning:


I narrowed it  down the following testcase,

#include <SDL/SDL.h>
#include <Python.h>

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

commenting out the first include (SDL/SDL.h) allows it to run w/o any problems.

SDL-1.2.13, Python 3.1.3 (Also tested w/ 3.2.), GCC 4.5.1,
w32api-3.17.1, mingw-rt-3.18 (Toolchain is a linux to windows cross
compiler, designed from
http://nathancoulson.com/proj_cross_mingw.shtml)

I noticed when I mess with the include order (Python.h before SDL.h), it gives

3rdparty/i686-pc-mingw32/include/SDL/SDL_config.h:131:0: warning:
"HAVE_SNPRINTF" redefined
3rdparty/i686-pc-mingw32/include/python3.2/pyerrors.h:361:0: note:
this is the location of the previous definition

it is defined in SDL_config.h as
#define HAVE_SNPRINTF 1

although no clue if it's related...  probably a red herring

-- 
Nathan Coulson (conathan)
------
Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com



More information about the Python-list mailing list