A request for help from a new user

The wxPython 2.8 (and earlier) series are limited to 32-bit because they are built upon the Carbon library and Apple did not release their 64-bit version of Carbon. You are likely running a 64-bit Python and so it is trying to load the 64-bit version from the extension moudles, but there isn't one. Hence, "no matching architecture in universal wrapper"

To work around this you can simply force Python to run in 32-bit mode, and since you appear to be using Python 2.7 there should be a "python2.7-32" command that you can run that will do that for you. If you don't like giving up the 64-bit Python an alternative would be to download and install the "cocoa" version of wxPython from the 2.9 release series.

···

On 8/27/11 3:12 PM, Alex Bridgland wrote:

Hi,
I hope I am not bothering too many people, and I hope I am not being
stupid - I am pretty inexperienced with python in general so I might
be a bit out of my depth. However, my problem is occurring whenever I
try to run a .py file in my mac's terminal which uses wxPython. I
wrote the following script based on a introductory tutorial:

import wx
app = wx.PySimpleApp()
frame = wx.Frame(None,-1,"Hello World")
frame.Show(1)
app.MainLoop()

I then proceed to run it like any other .py file and the following is
printed to my terminal:

ABRIDGLANDMAC:Python alexbridgland$ python wxTest1.py
Traceback (most recent call last):
   File "wxTest1.py", line 1, in<module>
     import wx
   File "/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.7/site-
packages/wx-2.8-mac-unicode/wx/__init__.py", line 45, in<module>
     from wx._core import *
   File "/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.7/site-
packages/wx-2.8-mac-unicode/wx/_core.py", line 4, in<module>
     import _core_
ImportError: dlopen(/usr/local/lib/wxPython-unicode-2.8.11.0/lib/
python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so, 2): no
suitable image found. Did find:
  /usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.7/site-packages/
wx-2.8-mac-unicode/wx/_core_.so: no matching architecture in universal
wrapper
ABRIDGLANDMAC:Python alexbridgland$

Sorry it is so messy... But I am stuck. The wxPython installation
seems to have worked since I can run the demos in the demo download
within the wxPython demo app. Is there anything you can suggest to fix
this? Anything at all would be hugely appreciated. I would really
rather not have to use tkInter which is working.

--
Robin Dunn
Software Craftsman

I recently ran into that, as I updated a system. The problem is that there are a lot of different binaries for Python on OS-X in the wild[*], so it's easy to end up running one that won't work with wxPYthon (or will only work with Robin's 32 bit trick)

My advice:

Re-install Python and wxPython (and then anything else you need.

1) Python2.7: install the 32 bit PPC+Intel 10.3 and above binary from python.org
   (there are two binaries there, one 32bit, PPC +Intel, one 32_64bit, Intel only, 10.6+ only)

2) make sure your PATH setting are right:

$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python

3) install the wxPython binary for 2.7

You should be good to go.

-Chris

[*] common python binaries I know of:

python.org 32 bit PPC+Intel
python.org 32+64 bit Intel only

macports
homebrew
fink
Activestate
Apple's "system" python (though I don't think they have a 2.7 -- or do they for Lion?

so you can see it can get messy.

-Chris

···

On 8/27/11 7:05 PM, Robin Dunn wrote:

On 8/27/11 3:12 PM, Alex Bridgland wrote:

ImportError: dlopen(/usr/local/lib/wxPython-unicode-2.8.11.0/lib/
python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so, 2): no
suitable image found. Did find:
/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.7/site-packages/
wx-2.8-mac-unicode/wx/_core_.so: no matching architecture in universal
wrapper

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov