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


Groups > comp.lang.python > #77200

Re: Py_SetProgramName() and prefixes

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <marko.havu@jyu.fi>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'paths': 0.07; '#include': 0.09; 'prefix': 0.09; 'testing,': 0.09; 'python': 0.11; 'wrote': 0.14; '%s,': 0.16; 'expected,': 0.16; 'path.': 0.16; 'received:fi': 0.16; 'stumbled': 0.16; 'weird': 0.16; 'fix': 0.17; 'char': 0.24; 'header:In-Reply-To:1': 0.27; 'supposed': 0.32; 'problem': 0.35; 'but': 0.35; 'doing': 0.36; 'received:10': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'header:Message-Id:1': 0.63; 'charset:windows-1252': 0.65; 'received:130': 0.73; 'behavior': 0.77; 'const': 0.84; 'it\x92s': 0.84
X-Virus-Scanned amavisd-new at cc.jyu.fi
Content-Type text/plain; charset=windows-1252
Mime-Version 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Subject Re: Py_SetProgramName() and prefixes
From Marko Havu <marko.havu@jyu.fi>
In-Reply-To <D361A7BF-0C50-4A59-9083-5F80755F792C@jyu.fi>
Date Thu, 28 Aug 2014 15:00:40 +0300
Content-Transfer-Encoding quoted-printable
References <D361A7BF-0C50-4A59-9083-5F80755F792C@jyu.fi>
To python-list@python.org
X-Mailer Apple Mail (2.1878.6)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.13553.1409227251.18130.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1409227251 news.xs4all.nl 2831 [2001:888:2000:d::a6]:57068
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77200

Show key headers only | View raw


I wrote earlier:

> While doing some testing, I stumbled across some weird behavior on Python 3.3 and 3.4: Py_GetPrefix(), Py_GetPath() and other functions that return paths that are supposed to be set by Py_SetProgramName() all return just ”/”:
> 
> ---------------- main.c ----------------
> #include <Python.h>
> #include <stdio.h>
> #include <stdlib.h>
> 
> int main(int argc, const char * argv[])
> {
>  printf("path: %s\n", getenv("PATH"));
>  Py_SetProgramName(L"/anaconda/envs/python3.4/bin/python");
>  Py_Initialize();
>  wprintf(L"prefix: %s\n", Py_GetPrefix());
>  PyRun_InteractiveLoop(stdin, "<stdin>");
>  Py_Finalize();
> 
>  return EXIT_SUCCESS;
> }
> ----------------

Doh. It’s supposed to be %S, not %s. When I fix that, the prefix is as expected, but I still have the original problem of Py_Initialize() not being able to find python in the path.

- Marko

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


Thread

Re: Py_SetProgramName() and prefixes Marko Havu <marko.havu@jyu.fi> - 2014-08-28 15:00 +0300

csiph-web