[Python-ideas] getpath differences Linux vs Windows

Charles Solar redcomet87 at gmail.com
Tue Jan 26 22:22:35 CET 2010

I have been integrating python scripting support into my project and have
been impressed at how easy it has been with boost::python and the excelant
documentation.  I ran into a technical 'problem' today while writing up
Makefiles for my project.  It is not really a problem, just unexpected
behavior that I want to propose a change for.  But first, a little
background info..

I have been doing most of my development so far in windows and just started
porting my project to linux yesterday.  Because I want to make using this
project as easy as possible and because I wanted a python debug build, I
integrated python into my building process in windows.  This involved
creating a new visual studio project for both pythonlib, and python exe, as
well as a few of the libraries such as _ctypes, _elementtree,
_multiprocessing, and _socket.  All these projects compile with my project
and the python Lib directory from the install is kept in a folder that I
then copy into the final destination folder if necessary.  I did all this
work so that my users could check out my project, build it, and run it with
python without installing python.  Also I wanted a debug build, as mentioned

Anyway, enough background, this works perfectly on windows because in
PC/getpathp.c when everything goes to hell and you cant figure out a path
you default to ./Lib
Because of this behavior, I can copy the Lib directory into the bin dir and
run python no problem.  I throw all the .py into $(BIN_DIR)/Lib and the C
libs in $(BIN_DIR)/DLLs and python is happy as a clam.

My trouble, and the reason for this email, is on linux the behavior is
different, and Modules/getpath.c does not default to ./Lib when everything
goes to hell, and I get
> ./python
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: No module named encodings.utf_8

I am going to spend the rest of my afternoon editing Modules/getpath.c and I
thought I would propose updating the non-windows getpath.c file to be more
in line with the windows one.  Or at least, have it take some pointers from

Thanks for your time
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100126/69156831/attachment.html>

More information about the Python-ideas mailing list