ActiveState Community

Using 32-bit Python from Komodo under Snow Leopard

Posted by jgarbers on 2009-10-20 16:54
OS: OS X

Apparently the Python in Snow Leopard runs in 64-bit mode, but many of my packages (wxPython, in particular) is only 32-bit. So when I try to run my app from Komodo 5.2.1, I get errors like this:

ImportError: /usr/local/lib/wxPython-unicode-2.8.10.1/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core_.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode)

Can anyone suggest a workaround? Is there a way to get Komodo to use 32-bit Python? I'm able to run my app from the TextMate Python bundle, but can't debug from there. Thanks!

toddw | Wed, 2009-10-21 09:25

If you require a 32-bit Python then you'll need to (build and) install the 32-bit version of Python yourself, then change Komodo's "Languages->Python" preferences to use the 32-bit Python version (by default Komodo uses the first Python it finds on your PATH).

Cheers,
Todd

jgarbers | Wed, 2009-10-21 09:57

Any time I get an answer that includes a variant on "build it yourself" I try to step back and look for an easier fix. :-) Luckily I found one.

The Python that comes with 10.6 apparently honors an environment variable called VERSIONER_PYTHON_PREFER_32_BIT. If that's set to 'yes', invoking Python from /usr/bin/python brings Python up in 32-bit mode. By default, it comes up in 64-bit mode.

That variable was being set in my .bash_profile, but I didn't have it set in Komodo. Adding it to my user environment variables solved the problem: Python launched by Komodo is in 32-bit mode and doesn't give me the above error.

Thanks!

toddw | Wed, 2009-10-21 10:02

Great news! Thanks for sharing this excellent (and much easier) workaround :)