[GRASS-user] Re: Georectify problem

William Kyngesburye woklist at kyngchaos.com
Wed Dec 2 14:15:56 EST 2009


On Dec 2, 2009, at 12:50 PM, Adam Dershowitz, Ph.D., P.E. wrote:

>> The way I have the python detection setup in the OSX startup, the first priority is always the same major.minor version it was built with, and for my Snow build it's 2.6.  Then the priorities are:
>> 
>> $GRASS_PYTHON setting
>> in $PATH
>> /Library/Frameworks/Python.framework
>> System python
>> 
>> So, if you have the system python in your PATH (running python from a Terminal), somehow that is failing, and if MacPorts python is in /Library/Frameworks, it finds that.
>> 
>> What does this give you:
>> 
>> type -p pythonw2.6
> 
>> type -p pythonw2.6
> /opt/local/bin/pythonw2.6

So, it's finding this first in the PATH test.  Which means the python_select is NOT completely switching the python to the system.

What is your current PATH (assuming you have selected the system python)?

echo "$PATH"

>> 
>> If it's only x86_64 (default on Snow), then yes wxpython will fail, as that is only possible 32bit.
>> 
> 
> So, yes this one is x84_64 only.  
> 
> But this one:
> 
>> file /opt/local/bin/python
> /opt/local/bin/python: Mach-O universal binary with 3 architectures
> /opt/local/bin/python (for architecture x86_64):	Mach-O 64-bit executable x86_64
> /opt/local/bin/python (for architecture i386):	Mach-O executable i386
> /opt/local/bin/python (for architecture ppc7400):	Mach-O executable ppc
> 
> is not.  
> 
Yet Python will still run 64bit by default.

> And I was able to determine that python_select is just a script.  What it does to select the apple version of python is just the following:
> 
> ln -sf python26-apple /opt/local/etc/select/python/current
> ln -snf /usr/bin/python2.6 /opt/local/bin/python
> ln -snf /usr/bin/pythonw2.6 /opt/local/bin/pythonw
> ln -snf /usr/bin/python2.6-config /opt/local/bin/python-config
> rm -f /opt/local/bin/idle
> ln -snf /usr/bin/pydoc2.6 /opt/local/bin/pydoc
> ln -snf /usr/bin/smtpd2.6.py /opt/local/bin/smtpd.py
> rm -f /opt/local/share/man/man1/python.1
> ln -snf /usr/share/man/man1/python2.6.1.gz /opt/local/share/man/man1/python.1.gz
> rm -f /opt/local/Library/Frameworks/Python.framework/Versions/Current
> rm -f /opt/local/Library/Frameworks/Python.framework/Headers
> rm -f /opt/local/Library/Frameworks/Python.framework/Resources
> rm -f /opt/local/Library/Frameworks/Python.framework/Python
> 
> So it looks to me like it should be creating the correct links.  So if I do this:
>> which python
> /opt/local/bin/python
> I do get the link in macports, but that is just a link to the apple version.  
> 
> I just noticed something however.  Are you actually searching for "python" or "python2.6" as your first priority?  The reason that I am asking is that "python" does point to the apple version. But python2.6 points to the macports version.  I wonder if that is the problem?
> Finally, you said that you actually start by trying $GRASS_PYTHON.  If, my my .profile,  I just point that to the system python should that fix this issue?
> 
Right, I search explicitly for the versioned python because in the Apple version, /usr/bin/python does not respond to the arch command, but /usr/bin/pythonw does.  And, because python will run 64bit by default, we need to force 32bit for wxpython to work.

So, since macports python_select works by symlinks and ignores versioned executable names (bug report), the workaround is as you say, set GRASS_PYTHON.


-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Theory of the Universe

There is a theory which states that if ever anyone discovers exactly what the universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarrely inexplicable.  There is another theory which states that this has already happened.

-Hitchhiker's Guide to the Galaxy 2nd season intro




More information about the grass-user mailing list