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


Groups > comp.lang.python > #93377

Py_InitializeEx() in CygWin64's Python2.7

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gvanem@yahoo.no>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.024
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'importerror:': 0.05; 'works.': 0.07; 'here?': 0.09; 'python': 0.11; '"set': 0.16; 'msvc.': 0.16; 'reason.': 0.16; 'load': 0.20; 'do.': 0.22; 'so.': 0.22; 'arguments': 0.22; 'assumes': 0.22; 'parse': 0.22; 'parsing': 0.22; 'see:': 0.22; 'module': 0.23; "i've": 0.24; 'seems': 0.24; 'written': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'skip:( 20': 0.28; 'fine': 0.29; 'skip:( 50': 0.29; "skip:' 10": 0.30; 'to:name:python-list': 0.31; 'maybe': 0.31; 'print': 0.31; "i'd": 0.31; 'worked': 0.31; 'skip:p 30': 0.32; 'point': 0.33; 'could': 0.35; 'to:addr:python-list': 0.35; 'fail': 0.35; 'really': 0.35; 'but': 0.36; 'should': 0.37; "skip:' 20": 0.37; 'doing': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'some': 0.40; 'received:46': 0.63; 'here': 0.66; 'special': 0.72; '2.7.': 0.84; 'from:addr:yahoo.no': 0.84; 'message-id:@yahoo.no': 0.84; 'mingw': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.no; s=s2048; t=1435765478; bh=K+7uwUqgRtnisWEif8/X9VFsKSbKqt8xbe0z/1x+7Xw=; h=Date:From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jul 2015 17:44:42 +0200
From Gisle Vanem <gvanem@yahoo.no>
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1
MIME-Version 1.0
To Python-list <python-list@python.org>
Subject Py_InitializeEx() in CygWin64's Python2.7
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.220.1435765587.3674.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1435765587 news.xs4all.nl 2878 [2001:888:2000:d::a6]:54791
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 4963
X-Received-Body-CRC 514200882
Xref csiph.com comp.lang.python:93377

Show key headers only | View raw


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

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


Thread

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

csiph-web