[Pythonmac-SIG] How do you debug Cocoa GUI with PyObjC
applications
Bob Ippolito
bob at redivi.com
Thu Feb 19 12:47:56 EST 2004
On Feb 19, 2004, at 11:55 AM, Vincent Marchetti wrote:
> I'm asking how people trace/debug/watch Python applications that use a
> Cocoa based GUI via
> PyObjC. I've got the PyObjC examples set, and as I pretty much
> expected they crash outright
> when run from PythonIDE (conflicting event loops I imagine). When I
> fiddle and try to run from a Terminal window using "pythonw
> mainApp.py" I get an error message complaining about lack of an
> Info.plist file, and finally when using the method of building a
> clickable application using bundlebuilder the examples run, but there
> is no obvious way to trace through the execution except by throwing
> off a lot of alert windows.
"pythonw objcguiapp.py" is never going to work because apps depending
on AppKit need to live in a bundle and be called a certain way. There
are ways around this, but they are hacky and require using private
apple APIs.
If you just want to look at the messages they spit out to the console,
you can open /Applications/Utilities/Console.app. It will tail your
console.log, which is basically stdout/stderr for processes that don't
otherwise have one.
If you want to interact with it, i.e. with pdb, or if you already have
terminal open anyway.. here is how I do it:
python buildapp.py --link build # build the app with a 'development'
style
`pwd`/build/AppName.app/Contents/MacOS/AppName # run the app by calling
the executable with a full path
Note that running under gdb is harder, if it's a real crash that you
need to debug... I won't get into that right now.
-bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040219/79faa6ff/smime.bin
More information about the Pythonmac-SIG
mailing list