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


Groups > comp.lang.python > #77200

Re: Py_SetProgramName() and prefixes

Subject Re: Py_SetProgramName() and prefixes
From Marko Havu <marko.havu@jyu.fi>
Date 2014-08-28 15:00 +0300
References <D361A7BF-0C50-4A59-9083-5F80755F792C@jyu.fi>
Newsgroups comp.lang.python
Message-ID <mailman.13553.1409227251.18130.python-list@python.org> (permalink)

Show all headers | 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