[GRASS-user] Re: Georectify problem

Adam Dershowitz, Ph.D., P.E. adershowitz at exponent.com
Wed Dec 2 13:50:18 EST 2009



On Dec 2, 2009, at 10:20 AM, William Kyngesburye wrote:

> On Dec 2, 2009, at 11:43 AM, Adam Dershowitz, Ph.D., P.E. wrote:
> 
>> While, when I run William Kyngesburye's build I see this in the terminal:
>> Rebuilding Addon menu...
>> Python 2.6.4 found.
>> 
>> But, at the command line, if I just do python, I end up with Apple version 2.6.1.  I will also ask about this on the macports list, which is very active.
>> 
>> For what it is worth, I know that in the past, with 10.5, and Macports installed I was able to run the wxpython version, but I can't seem to get it to work now.  
> 
> Where does MacPorts install its Python?  And is it a frameowrk build?  I know it normally keeps everything isolated in its own folder, but maybe Python is different, if it's a framework.

It does put it into /opt/local.  Yes, it is a framework build, but in the macports directories.  So it puts a few things into /opt/local/bin and opt/local/lib but most of it goes into /opt/local/Library/Frameworks/Python.framework

> 
> 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

> 
> and this:
> 
> `type -p pythonw2.6` -V

>`type -p pythonw2.6` -V
Python 2.6.4


> 
> Then we get to the architectures.  Does MacPorts build universal by default or just the default ssytem architecture?  Try:
> 
> file /path/to/macports/python/bin/python

>file /opt/local/bin/python2.6
/opt/local/bin/python2.6: Mach-O 64-bit executable x86_64

> 
> 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.  

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?

Thanks,

--Adam


More information about the grass-user mailing list