Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77200 > unrolled thread
| Started by | Marko Havu <marko.havu@jyu.fi> |
|---|---|
| First post | 2014-08-28 15:00 +0300 |
| Last post | 2014-08-28 15:00 +0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Py_SetProgramName() and prefixes Marko Havu <marko.havu@jyu.fi> - 2014-08-28 15:00 +0300
| From | Marko Havu <marko.havu@jyu.fi> |
|---|---|
| Date | 2014-08-28 15:00 +0300 |
| Subject | Re: Py_SetProgramName() and prefixes |
| Message-ID | <mailman.13553.1409227251.18130.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web