From flyx at isobeef.org Fri Dec 2 23:21:33 2011 From: flyx at isobeef.org (Felix Krause) Date: Fri, 2 Dec 2011 23:21:33 +0100 Subject: [gps-devel] Python and GTK-OSX Message-ID: <497E4B3F-07CF-4D65-8623-E8A8E64BB618@isobeef.org> Hi everyone, I'm trying to compile GPS and link it against GTK-OSX (http://live.gnome.org/GTK%2B/OSX/Building), which provides a more native interface on MacOSX. So far, I succeeded in compiling the binary, but when I try to start it, it always fails to initialize Python (I linked against the Python framework that comes with MacOSX Lion). My first attempt looked like this: $ ~/gtk/inst/bin/gps Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale. ImportError: No module named site I guess the Gtk-WARNING can be ignored for now. The problem here is that Python does not know the directory where its modules are located. So I did: $ export PYTHONPATH=/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 $ ~/gtk/inst/bin/gps Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale. Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 555, in main() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 537, in main known_paths = addusersitepackages(known_paths) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 268, in addusersitepackages user_site = getusersitepackages() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243, in getusersitepackages user_base = getuserbase() # this will also set USER_BASE File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 233, in getuserbase USER_BASE = get_config_var('userbase') File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 523, in get_config_var return get_config_vars().get(name) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 419, in get_config_vars _init_posix(_CONFIG_VARS) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 287, in _init_posix raise IOError(msg) IOError: invalid Python installation: unable to open /Users/Felix/gtk/inst/lib/python2.7/config/Makefile (No such file or directory) While Python does find its modules now, it still fails to load its configuration files. I tried to set the other python environment variables (PYTHONHOME, PYTHONFRAMEWORK, PYTHONBASE) to the corresponding places in the framework, but nothing changed. Python looks for its configuration in the installation prefix of GTK-OSX, where the GPS binary lies, instead of using the system's Python installation. I cannot tell whether this problem originates on the Python side or on the GPS side. Does anyone have advice? Btw, I currently use GPS revision 177042, as this is the first revision I found that I succeeded to compile (with some modifications to the build system). I didn't have luck with the release version 5.0.1, nor with newer svn revisions. Cheers, Felix -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 455 bytes Desc: Message signed with OpenPGP using GPGMail Url : /pipermail/gps-devel/attachments/20111202/688f7ace/attachment.pgp From setton at adacore.com Sat Dec 3 00:36:17 2011 From: setton at adacore.com (Nicolas Setton) Date: Sat, 3 Dec 2011 00:36:17 +0100 (CET) Subject: [gps-devel] Python and GTK-OSX In-Reply-To: <497E4B3F-07CF-4D65-8623-E8A8E64BB618@isobeef.org> References: <497E4B3F-07CF-4D65-8623-E8A8E64BB618@isobeef.org> Message-ID: <1258771889.1768.1322868977750.JavaMail.open-xchange@xchange.eu.adacore.com ? Hello Felix, ? [...] ? > While Python does find its modules now, it still fails to load its > configuration files. I tried to set the other python environment variables > (PYTHONHOME, PYTHONFRAMEWORK, PYTHONBASE) to the corresponding places in the > framework, but nothing changed. Python looks for its configuration in the > installation prefix of GTK-OSX, where the GPS binary lies, instead of using > the system's Python installation. I cannot tell whether this problem > originates on the Python side or on the GPS side. Does anyone have advice? ? Recent versions of GPS pass the contents of the variable GPS_PYTHONHOME to its Python interpreter. (We did use "PYTHONHOME" before, but found out some cases in which this interfered too much with the users' environment). ? > Btw, I currently use GPS revision 177042, as this is the first revision I > found that I succeeded to compile (with some modifications to the build > system). I didn't have luck with the release version 5.0.1, nor with newer svn > revisions. ? You are probably not far from succeeding with the recent version. Don't hesitate to post problems here - it's possible that someone has solved them before. ? Regards, ? Nicolas ?