Tuesday, December 11, 2012

Debugging maptiler on Mac

Running maptiler on Mac is no easy task, as I've found out.

While there are a few stumbling blocks when it comes to dependencies, one that I found particularly perplexing is the bundling of a two Python executables in the .app package.  The maptiler executable is written in such a way as to not only to run the rest of the package through one or other of the Python executables, but to choose based on 32 or 64 bit architecture.  That's independent of the version of Mac OS being run, or the "current" Python.  Most dependency installers will install relative to the "current" Python, and its path.  Therefore, on the 32-bit MacBook Pro I was testing on, I was being kicked on to the bundled Python 2.5 executable, and missing all my dependencies.  This caused various dependency errors, including "ImportError: No module named osgeo"

Here is are the important diffs in maptiler.app that caused it to work: in ../MapTiler.app/Contents/MacOS/maptiler 6,9c6,9 < #if sys.maxint > 2**32: < executable = os.path.join(execdir, "PythonSnow") < #else: < # executable = os.path.join(execdir, "Python") --- > if sys.maxint > 2**32: > executable = os.path.join(execdir, "PythonSnow") > else: > executable = os.path.join(execdir, "Python") and in ../MapTiler.app/Contents/Resources/maptiler/pp/__init__.py 141,147d140 < # fix PYTHONEXECUTABLE dict error < < if "PYTHONEXECUTABLE" in os.environ: < executable = os.environ["PYTHONEXECUTABLE"] < else: < executable = sys.executable < 156c149 < command = "\"" + executable + "\" -u \"" \ --- > command = "\"" + os.environ["PYTHONEXECUTABLE"] + "\" -u \"" \
Relevant link at Google Code: http://code.google.com/p/maptiler/issues/detail?id=42

No comments: