Python 2.6.1 @executable_path
torriem at gmail.com
Sun Jan 11 17:29:21 CET 2009
googler.1.webmaster at spamgourmet.com wrote:
> Thank you, I found PySys_SetPythonHome() to set the path where the lib
> folder of Python is, but I guess they are not really implemented
> because they are fixed compiled with an absolute path, aren't they?
I'm afraid I'm not following you here. What is fixed compiled with an
absolute path? What path are you talking about here? Linker path?
Python default path for importing modules?
Please read the documentation on embedding python and you'll see that
you can initialize python and tell it to look anywhere for import
modules. This is really all you have to do. In fact, if you import the
built-in "sys" module, you can, from C++, add your Resource folder path
to the sys.path dictionary (using api calls) and dynamically affect
where python will import from. I did this once when I had a case where
the user could place his plugin in an arbitrary spot. Hence I had to
dynamically add the location to the path.
If you are embedding python in your app, I would expect you to be
familiar with the python apis.
> Thats the problem. I hadn't compiled Python and I don't know if I
> compile it as a dylib file or a framework? hmm. I know how to create a
> framework but compiling as a dylib hadn't worked yet. :-(
I'm very confused as previously you were talking about compiling python
and now you're talking about not compiling python. Although it doesn't
matter, since a framework file is a dylib file.
In any case if you don't know how to set the linker paths (to relative)
in App bundles, you'll want to consult apple docs, and the various apple
More information about the Python-list