[wxPython-mac] Re: [Pythonmac-SIG] Re: [wxPython] Compiling wxPython on OS X 10.1

Sorry for the late response! I built from CVS just fine, but the problem
persists. I think it may be an issue with the wxWindows shared library
though - not Python. I can start up two copies of the Python interactive
terminal just fine. It is only when I try to run a wxPython script in two
terminals that I get the bus error. I haven't done extensive testing, but
this is what I have found so far. Is there any way to track down what "Bus
error" means exactly? =)

Then this may be another example of the bug I ran into, but then again it may
be something completely different. I'll explain my findings, this may help you
along.

As of 10.1 Mac OS X is a lot more critical about using Carbon in non-.app
programs. Apparently this was already officially illegal in 10.0, but only
since 10.1 are there real problems. One thing you cannot do is include
window-related portions of Carbon.framework (such as WindowMgr or DialogMgr
calls) if no window manager is available (ssh connection as another user than
the person logged in on the desktop, OS X Server, >console style login). You
will immedeately get
kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
kCGErrorInvalidConnection : CGSGetEventPort: Invalid connection
and then a crash.

Even if you do have a window manager it seems calling using Carbon from a
non-.app program is dangerous. If you call the program once from a terminal
window everything seems fine. Except of course that a non-.app program can
open windows, but it can't interact with them, show up in the toolbar, etc
(you were aware of this, by the way, that you must be a .app style bundle to
interact with the user?).

But: if you call that same program a second time from a different window you
will probably get a coredump. Trying to debug this is difficult (when either
copy is run under gdb everything works fine!), but by tracing library loading
it seems that the crash is in the initialization of the HIToolbox portion of
Carbon.

The conclusion of all this is that it seems unsafe to link anything that could
be run from the commandline against Carbon. If this appears to be the problem
with wxWindows too the solution is simple: use a .app. If you're hosting this
in Python already (I think you are, right?) then build the Python.app
according to the instructions in Mac/OSX/README in the python disitrbuiton.

···

--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm

Thanks Jack, that was the magic I was hunting for. It's still VERY flakey
but at least I am seeing the windows now...

Here's a screenshot of the wxPython demo running on Max OS X:
http://alldunn.com/wxPython/stuff/wxMacPython-Demo.jpg

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

----- Original Message -----
From: "Jack Jansen" <jack@oratrix.nl>
To: <wxpython-mac@lists.wxwindows.org>
Cc: <wxpython-users@lists.wxwindows.org>; "Wx-Users"
<wx-users@lists.wxwindows.org>; <pythonmac-sig@python.org>
Sent: Friday, November 09, 2001 1:20 AM
Subject: Re: [wxPython-mac] Re: [Pythonmac-SIG] Re: [wxPython] Compiling
wxPython on OS X 10.1

> Sorry for the late response! I built from CVS just fine, but the problem
> persists. I think it may be an issue with the wxWindows shared library
> though - not Python. I can start up two copies of the Python interactive
> terminal just fine. It is only when I try to run a wxPython script in

two

> terminals that I get the bus error. I haven't done extensive testing,

but

> this is what I have found so far. Is there any way to track down what

"Bus

> error" means exactly? =)

Then this may be another example of the bug I ran into, but then again it

may

be something completely different. I'll explain my findings, this may help

you

along.

As of 10.1 Mac OS X is a lot more critical about using Carbon in non-.app
programs. Apparently this was already officially illegal in 10.0, but only
since 10.1 are there real problems. One thing you cannot do is include
window-related portions of Carbon.framework (such as WindowMgr or

DialogMgr

calls) if no window manager is available (ssh connection as another user

than

the person logged in on the desktop, OS X Server, >console style login).

You

will immedeately get
kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
kCGErrorInvalidConnection : CGSGetEventPort: Invalid connection
and then a crash.

Even if you do have a window manager it seems calling using Carbon from a
non-.app program is dangerous. If you call the program once from a

terminal

window everything seems fine. Except of course that a non-.app program can
open windows, but it can't interact with them, show up in the toolbar, etc
(you were aware of this, by the way, that you must be a .app style bundle

to

interact with the user?).

But: if you call that same program a second time from a different window

you

will probably get a coredump. Trying to debug this is difficult (when

either

copy is run under gdb everything works fine!), but by tracing library

loading

it seems that the crash is in the initialization of the HIToolbox portion

of

Carbon.

The conclusion of all this is that it seems unsafe to link anything that

could

be run from the commandline against Carbon. If this appears to be the

problem

with wxWindows too the solution is simple: use a .app. If you're hosting

this

in Python already (I think you are, right?) then build the Python.app
according to the instructions in Mac/OSX/README in the python

disitrbuiton.

--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig

++++

www.cwi.nl/~jack | see

http://www.xs4all.nl/~tank/spg-l/sigaction.htm

_______________________________________________
wxPython-mac mailing list
wxPython-mac@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-mac

That is excellent!

Keep up the good work. I can hardly wait. This is the only thing holding up GNU Enterprise on the Mac (well at least until we start the debug process) :slight_smile:

···

At 11:15 AM -0800 11/9/01, Robin Dunn wrote:

Thanks Jack, that was the magic I was hunting for. It's still VERY flakey
but at least I am seeing the windows now...

Here's a screenshot of the wxPython demo running on Max OS X:
http://alldunn.com/wxPython/stuff/wxMacPython-Demo.jpg

--
Neil
neilt@gnue.org
GNU Enterprise
http://www.gnuenterprise.org/
http://www.gnuenterprise.org/~neilt/sc.html

I gotta ask - how well does PyCrust hold up on the Mac?

···

---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."

-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Robin Dunn
Sent: Friday, November 09, 2001 1:16 PM
To: wxpython-mac@lists.wxwindows.org
Cc: wxPython-users; Wx-Dev
Subject: [wxPython] wxPython on Mac Screenshot!!!

Thanks Jack, that was the magic I was hunting for. It's still VERY flakey
but at least I am seeing the windows now...

Here's a screenshot of the wxPython demo running on Max OS X:
http://alldunn.com/wxPython/stuff/wxMacPython-Demo.jpg

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

----- Original Message -----
From: "Jack Jansen" <jack@oratrix.nl>
To: <wxpython-mac@lists.wxwindows.org>
Cc: <wxpython-users@lists.wxwindows.org>; "Wx-Users"
<wx-users@lists.wxwindows.org>; <pythonmac-sig@python.org>
Sent: Friday, November 09, 2001 1:20 AM
Subject: Re: [wxPython-mac] Re: [Pythonmac-SIG] Re: [wxPython] Compiling
wxPython on OS X 10.1

> Sorry for the late response! I built from CVS just fine, but the problem
> persists. I think it may be an issue with the wxWindows shared library
> though - not Python. I can start up two copies of the Python interactive
> terminal just fine. It is only when I try to run a wxPython script in

two

> terminals that I get the bus error. I haven't done extensive testing,

but

> this is what I have found so far. Is there any way to track down what

"Bus

> error" means exactly? =)

Then this may be another example of the bug I ran into, but then again it

may

be something completely different. I'll explain my findings, this may help

you

along.

As of 10.1 Mac OS X is a lot more critical about using Carbon in non-.app
programs. Apparently this was already officially illegal in 10.0, but only
since 10.1 are there real problems. One thing you cannot do is include
window-related portions of Carbon.framework (such as WindowMgr or

DialogMgr

calls) if no window manager is available (ssh connection as another user

than

the person logged in on the desktop, OS X Server, >console style login).

You

will immedeately get
kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
kCGErrorIllegalArgument : CGSNewConnection cannot get connection port
kCGErrorInvalidConnection : CGSGetEventPort: Invalid connection
and then a crash.

Even if you do have a window manager it seems calling using Carbon from a
non-.app program is dangerous. If you call the program once from a

terminal

window everything seems fine. Except of course that a non-.app program can
open windows, but it can't interact with them, show up in the toolbar, etc
(you were aware of this, by the way, that you must be a .app style bundle

to

interact with the user?).

But: if you call that same program a second time from a different window

you

will probably get a coredump. Trying to debug this is difficult (when

either

copy is run under gdb everything works fine!), but by tracing library

loading

it seems that the crash is in the initialization of the HIToolbox portion

of

Carbon.

The conclusion of all this is that it seems unsafe to link anything that

could

be run from the commandline against Carbon. If this appears to be the

problem

with wxWindows too the solution is simple: use a .app. If you're hosting

this

in Python already (I think you are, right?) then build the Python.app
according to the instructions in Mac/OSX/README in the python

disitrbuiton.

--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig

++++

www.cwi.nl/~jack | see

http://www.xs4all.nl/~tank/spg-l/sigaction.htm

_______________________________________________
wxPython-mac mailing list
wxPython-mac@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-mac

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

I gotta ask - how well does PyCrust hold up on the Mac?

Don't know yet. I couldn't get that far in the main demo so I am working on
some small simple samples now so I can more easily see what's working and
figure out what's not.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

<<snip>>

The conclusion of all this is that it seems unsafe to link anything that

could

be run from the commandline against Carbon. If this appears to be the

problem

with wxWindows too the solution is simple: use a .app. If you're hosting

this

in Python already (I think you are, right?) then build the Python.app
according to the instructions in Mac/OSX/README in the python

disitrbuiton.

Thanks for your detailed response!! It was very informative, and as you
already know, this was *exactly* the problem. Like Robin said, it is still
somewhat flaky but at least now we can see that it is flaky. =) And of
course, if we can actually see what the bugs are its easier to trace down
and fix the problem. =) One error I thought I'd throw out to you and the
groups. Messages like the ones below pop up from time to time in the console
when running wxPython apps:

···

--------------------------------------------------
Nov 9 10:25:54 localhost
/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder:
kCGErrorFailure : _CGSLockAndUpdateWindow: cannot map visRegion shmem

Nov 9 10:25:54 localhost
/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder:
kCGErrorFailure : _CGSLockAndUpdateWindow: cannot map shapeRegion shmem

Nov 9 10:25:54 localhost
/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder:
kCGErrorFailure : _CGSLockAndUpdateWindow: cannot map shapeRegion shmem
----------------------------------------------------

I haven't yet figured out how to reproduce them (it seems to be behaving at
the moment), but my suspicion (since it's the finder throwing errors) is
that this has something to do with the top menubar and it being 'registered'
as an app. Python does not list its name in the top menubar, even when
running a wxPython script, and also the menubars for the wxPython app do not
appear. (Menubars do appear for compiled wxMac applications.) The error
messages (kCGErrorFailure) looked familiar to the ones that occurred with
command line Python, and I thought this may be related to Python.app itself
so I thought I would see if this meant anything to anyone. It also will only
run one copy of Python at a time - it "beeps" if you try to run another
Python script. Any thoughts? Is there a place where code specifying Python's
"behavior" as an app are specified, or are the limitations due to the fact
that it is a CLI app?

I don't yet know too much about building app bundles on OS X, but it looks
like it would be good to learn, so I'll probably do some more poking around
on the subject in the next week or so. Too bad I don't have a Mac at home,
although since I have school work that is probably a VERY bad idea. ^_^;
(One I will no doubt indulge myself in sometime soon though...!)

Thanks again to you, Robin and everyone else for all your help!! It feels
*really* good to get over this hurdle! =) Still more to get through, but
this is one big step closer to making wxPython on Mac a reality!

Kevin