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


Groups > comp.lang.python > #93377 > unrolled thread

Py_InitializeEx() in CygWin64's Python2.7

Started byGisle Vanem <gvanem@yahoo.no>
First post2015-07-01 17:44 +0200
Last post2015-07-01 17:44 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Py_InitializeEx() in CygWin64's Python2.7 Gisle Vanem <gvanem@yahoo.no> - 2015-07-01 17:44 +0200

#93377 — Py_InitializeEx() in CygWin64's Python2.7

FromGisle Vanem <gvanem@yahoo.no>
Date2015-07-01 17:44 +0200
SubjectPy_InitializeEx() in CygWin64's Python2.7
Message-ID<mailman.220.1435765587.3674.python-list@python.org>
I've written a C-program that embeds Python 2.7.
It has worked fine for several years using MingW or MSVC. Now I'd like
to support the python2.7.exe that comes with CygWin64.

But it seems to fail inside 'Py_InitializeEx(0)' where it just prints:
   ImportError: No module named site

What? Does really all Pythons needs a 'PYTHONPATH' set to point to the
site.py? Or is it only CygWin that is special here? Since if I do a
"set PYTHONPATH=/usr/lib/python2.7" in my shell, my program works.

These are some of the func-ptr and arguments I use during init:

  Py_SetProgramName ("/cygdrive/f/gv/VC_project/EnvTool/src/envtool.exe")
  Py_SetPythonHome ("/usr/lib/python2.7")
  Py_InitializeEx(0)   << libpython2.7.dll chokes inside here for a mysterious reason.

I maybe naively assumes calling 'Py_SetPythonHome' is doing part of
what parsing the PYTHONPATH should do. But it doesn't seems so.

If I from my cmd-line do a:

c:\> f:\CygWin64\bin\python2.7.exe -c "import sys; print (sys.modules)"

I can see:
   <module 'site' from '/usr/lib/python2.7/site.pyo'>

So what could be the reason it's not able to load and parse it
without a 'PYTHONPATH' set explicit?

-- 
--gv

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web