tl;dr: Why can a Python package behave differently when imported using PYTHONPATH and PYTHONHOME? Specifically, work with *HOME but not with *PATH.
Hi all, While packaging Gnome15[1] I stumbled across a strange problem. I've cleaned up gnome2.gnome_python package to use the default build system[2]. After that `import gconf` stopped working in the application. It turned out that the package has been patched to move gconf.so to site-packages instead of a gtk-2.0 subdirectory, and I have removed this patch. While investigating why was it needed in the first place I noticed that on an Arch machine the package is laid out the upstream way[3] but it works. On a whim I've tried to import the same package in a wrapped Python and lo and behold -- it worked. To reproduce this behaviour: 1. Check out my gnome15 branch[4]; 2. Run `nix-shell -A gnome15`; 3. Run python2; try `import gconf`; notice it fails; 4. Run $PYTHON; try `import gconf`; notice it works. The difference is that python2 is a regular Python using $PYTHONPATH that is automatically set in the build environment, and $PYTHON is a wrapped Python using $PYTHONHOME (python.buildEnv)[5]. Why does it have different behaviour? Currently Python applications wrapped with our magical sed expression behave similarly to PYTHONPATH (i.e. can't import this package). I hope to fix this but I'm not sure what's going on. 1: https://gnome15.org/ 2: https://github.com/abbradar/nixpkgs/commit/04da99f3a83d59d70d0965a72d761856b823554e 3: https://www.archlinux.org/packages/extra/i686/python2-gconf/files/ 4: https://github.com/abbradar/nixpkgs/commits/gnome15 5: https://github.com/abbradar/nixpkgs/commit/becf31fc204d023639edbbce0feb6076c4810d6c -- Nikolay. _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev