[Pythonmac-SIG] (re)newbie py2app question

Ned Deily nad at acm.org
Mon Mar 5 03:24:11 CET 2012


In article 
<CAJCj7-zT0iP9T7d53JOenjHaS4Gq9_39bRwEGL-wtMei84Ncgw at mail.gmail.com>,
 Charles Hartman <cohar at conncoll.edu> wrote:

> I'm just coming back to programming after years, trying to recompile an old
> program that works but needs updating and expansion.  I'm now on OS 10.6.8,
> Python 2.7.2, with wxPython (64/32bit).    My newly installed py2app
> is: py2app-0.6.4-py2.7.egg.  All of these were in earlier versions when I
> last packaged the program with py2app.
> 
> In Console, the errors seem to be of two kinds.  There's a long list of
> ScriptingAdditions messages about missing architectures.  Before that,
> there's this:
> [0x0-0x1bcfbce].org.pythonmac.unspecified.PyProse[87375] NameError: global
> name 'self' is not defined
> 
> That seems to be in a module of the program that certainly did work before.
>  I can debug the program in WingIDE, I get no problems or errors (except
> maybe the ScriptingAdditions ones) when I run it there.
> 
> Have I forgotten something simple?  Has something changed that I missed?

There are significant changes in OS X 10.6 compared to earlier versions.  
The major difference is that 64-bit Intel (aka -arch x86_64) is now the 
preferred build and execution architecture.   While 32-bit Intel and 
even 32-bit PPC execution (via Rosetta emulation) are still supported, a 
64-bit/32-bit executable will, by default, run in 64-bit mode.  
Unfortunately, many older Carbon APIs are only available in 32-bit mode, 
as Apple cancelled earlier plans to make 64-bit versions of them.  
Chances are you are running into a problem with trying to use them.  You 
*may* be able to work around the problem by forcing your 64-bit/32-bit 
Python to run in 32-bit mode.  For the python.org 2.7.2, you should be 
able to do this by invoking Python as 'python2.7-32'.

Another option might be to use the 32-bit-only python.org installer but 
be aware that there will be problems using this method on OS X 10.7 Lion.

Also, life will likely be easier for you on 10.6 if you stick with Xcode 
3.2.x (still available for download from the Apple Developer Connection) 
rather than the optional Xcode 4.x releases which are also the default 
on 10.7;  the latest versions of Xcode 4.x no longer supply the 
traditional gcc-4.2 that those Pythons were built with and expect to 
find to build C extension modules.  But, if you will eventually need to 
support 10.7, you should probably dig deeper into the errors and make 
your program work in 64-bit mode as well.

Good luck!

-- 
 Ned Deily,
 nad at acm.org



More information about the Pythonmac-SIG mailing list