(re)newbie py2app question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

(re)newbie py2app question

Charles Hartman-2
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?

Thanks for any help.

--

Charles O. Hartman
Poet in Residence
Lucy Marsh Haskell '19 Professor of Literatures in English


_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Reply | Threaded
Open this post in threaded view
|

Re: (re)newbie py2app question

Ned Deily
In article
<[hidden email]>,
 Charles Hartman <[hidden email]> 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,
 [hidden email]

_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Reply | Threaded
Open this post in threaded view
|

Re: (re)newbie py2app question

Charles Hartman-2
Dear Ned (the ever-helpfu-and-clear; I've been following the listserv even over the non-programming years),

Thanks.  FWIW, I'm not using Xcode at all.  I'm aware of the 32/64 change.  I thought I had addressed it: my Python 2.7 runs in 64-bit mode (sys.maxsize == 2 ** 64 yields True).  My wxPython ("classic," they call it, for no clear reason; filename wxPython2.9-osx-2.9.3.1-cocoa-py2.7.dmg) purports to be friendly to either 64-bit or 32-bit.  What other API would be out of step?

Is the fact that the program runs without error inside the Wing IDE debugger irrelevant?

Grateful but still bewildered,
Charles Hartman


On Sun, Mar 4, 2012 at 9:24 PM, Ned Deily <[hidden email]> wrote:
In article
<[hidden email]>,
 Charles Hartman <[hidden email]> 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,
 [hidden email]

_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG



--

Charles O. Hartman
Poet in Residence
Lucy Marsh Haskell '19 Professor of Literatures in English


_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Reply | Threaded
Open this post in threaded view
|

Re: (re)newbie py2app question

Ned Deily
In article
<CAJCj7-wVV5asiQuvQwxgLrti+Pv=[hidden email]>,
 Charles Hartman <[hidden email]> wrote:
> Thanks.  FWIW, I'm not using Xcode at all.  I'm aware of the 32/64 change.
>  I thought I had addressed it: my Python 2.7 runs in 64-bit mode
> (sys.maxsize == 2 ** 64 yields True).  My wxPython ("classic," they call
> it, for no clear reason; filename wxPython2.9-osx-2.9.3.1-cocoa-py2.7.dmg)
> purports to be friendly to either 64-bit or 32-bit.  What other API would
> be out of step?
>
> Is the fact that the program runs without error inside the Wing IDE
> debugger irrelevant?

So much for idle (not IDLE) speculation on my part.  Without more
information, it's hard to guess and I don't have any personal experience
with the new Cocoa-based wxPython.  Perhaps if you posted more details
(in particular, exactly what errors you see), someone might be able to
help.  You could also try printing the value of sys.path when you are
running in the debugger and when not.

--
 Ned Deily,
 [hidden email]

_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Reply | Threaded
Open this post in threaded view
|

Re: (re)newbie py2app question

Chris Barker
In reply to this post by Charles Hartman-2
On Sun, Mar 4, 2012 at 7:28 PM, Charles Hartman <[hidden email]> wrote:
>  My wxPython ("classic," they call it,
> for no clear reason;

IN case you're curios -- "classic" refers to it being the latest
version of the SWIG-based wrappers that have been around for years --
Robin is now working on an updated wxPython built differently, that he
calls "Project Phoenix".

--

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

[hidden email]
_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Reply | Threaded
Open this post in threaded view
|

Re: (re)newbie py2app question

Charles Hartman-2
Ah, thanks.  On the wxPython list I had a response from RD which suggested, puzzlingly, that it might be a 32-bit/64-bit problem.  But my Python is running in 64-bit, and that version of wxPython is advertised as 32/64.  So I'm baffled.



On Tue, Mar 6, 2012 at 5:19 PM, Chris Barker <[hidden email]> wrote:
On Sun, Mar 4, 2012 at 7:28 PM, Charles Hartman <[hidden email]> wrote:
>  My wxPython ("classic," they call it,
> for no clear reason;

IN case you're curios -- "classic" refers to it being the latest
version of the SWIG-based wrappers that have been around for years --
Robin is now working on an updated wxPython built differently, that he
calls "Project Phoenix".

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:%28206%29%20526-6959" value="+12065266959">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:%28206%29%20526-6329" value="+12065266329">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:%28206%29%20526-6317" value="+12065266317">(206) 526-6317   main reception

[hidden email]
_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG



--

Charles O. Hartman
Poet in Residence
Lucy Marsh Haskell '19 Professor of Literatures in English


_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Reply | Threaded
Open this post in threaded view
|

Re: (re)newbie py2app question

Ronald Oussoren
In reply to this post by Charles Hartman-2

On 4 Mar, 2012, at 12:18, Charles Hartman 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?


You could try to run the application from Terminal.app, for an app named Foo.app you'd run /path/to/Foo.app/Contents/MacOS/Foo (where /path/to is the directory containing Foo.app). That way errors get printed to the Terminal window instead of in the console log, that way you should be able to see more information and probably also a Python traceback for the NameError, which will hopefully help in locating the source of the problem.

Ronald


Thanks for any help.

--

Charles O. Hartman
Poet in Residence
Lucy Marsh Haskell '19 Professor of Literatures in English

_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


_______________________________________________
Pythonmac-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

smime.p7s (6K) Download Attachment